[Rails] Destroy method link_to show
Rails 3.1.3
I have User model and Plan model
User has the following association
has_many :gives, :class_name => "Plan", :foreign_key => :give_id,
:dependent => :destroy
And a view generates
<% @user.gives.each do |give| %>
...
<li><%= link_to 'Delete', {:controller => :plans, :action =>
:destroy, :id => give.id}, confirm: 'Are you sure?', :class=>'btn
btn-mini' %></li>
...
It is not Plan's view, so I specified :controller as well.
This Delete link somehow leads to Plan show action. It does not delete
it as I want it to.
Do you see any problem here ?
Honestly, I don't know what else to show you in order to find the
problem. If more information is needed, please let me know.
Thanks
soichi
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home