I have successfully rendered an ajax request for a show controller(raffle). In the new modal, I am trying to render a partial from another controller(email) but I am getting the new form from the raffle controller. When I look in the terminal, it says that I am rendering the raffles/_new and the emails/_new, however, the email form is not showing. Here is the terminal info:
Raffle Load (0.2ms) SELECT "raffles".* FROM "raffles" WHERE
"raffles"."id" = $1 LIMIT $2 [["id", 6], ["LIMIT", 1]]
Rendering raffles/show.js.erb
Rendered layouts/_errors.html.erb (0.5ms)
Rendered raffles/_form.html.erb (12.0ms)
Rendered emails/_new.html.erb (21.5ms)
Rendered raffles/_show.html.erb (37.5ms)
Rendered raffles/show.js.erb (51.3ms)
My raffle controller's show action has:
def show
@raffle = Raffle.find(params[:id])
@email = Email.new
end
My show view:
<%= render '/emails/new', :locals => { :raffle_id => @raffle.id, :email => @email } %>
emails/new is a partial which renders 'form' and form is:
<%= form_for email do |f| %>
<%= f.text_field :email, :placeholder => "Your Email" %>
<%= f.hidden_field :raffle_id, :value => raffle_id %>
<%= f.submit "Enter", :class => 'btn-pop' %>
<% end %>
For some reason, my show is showing raffles new form rather than emails new form. Might anybody know what is going on?