Ruby on Rails
Wednesday, March 7, 2018
I'm not calling from a main app page I'm calling and rendering the follow form from inside a mounted engine The follow model belongs to polymorphic association followable so in this case followable_type should be Mnt but it's appearing as ApplicationRecord
This is the form that was submitted:
<%= form_tag follow_path(mnt_id: @mnt.id), method: :post, remote: true do %>
<% button_tag class: 'btn btn-primary ' do %>
<%= 'Follow' %>
<% end %>
This is the controller:
def create
if params[:user_id]
@user = User.find(params[:user_id])
current_user.follow(@user)
elsif params[:mnt_id]
@mnt = Mnt.find(params[:mnt_id])
current_user.follow(@mnt)
end
end
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b5ef8834-108d-4c3b-86d0-04cfa3fb5e82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment