Ruby on Rails Thursday, January 26, 2012



On Thu, Jan 26, 2012 at 3:19 AM, Daisy Di <lists@ruby-forum.com> wrote:
Dear All,
i want to delect a record with the code
 <% @reservations.each do |reservation| %>
 <tr>
   <td>00000<%= reservation.id%></td>
   <td><%= reservation.item_desc %></td>
   <td><%= reservation.item_desc %></td>
   <td><%= reservation.created_on %></td>
   <td><%= reservation.valid_until %></td>
   <td><%= link_to 'Destroy',reservation, :confirm => 'Are you
            sure?' ,:method => :delete%></td>
 </tr>

but when i click the link ,it will redirect to the show page ,it means
that the show action is invoked,acturally i want to delete it not show
the details, so ,i think the :method=>:delete doesnt work, i search a
lot to find the solution,some advise to add <%= javascript_include_tag
:all %> to the layout,but it still doesnt work, anyone can help me ?
Thanks very much.


you want to destroy them using ajax? or just destroy?
What do you have on your destroy action in the controller?

Javier 

--
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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment