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. PS: http://stackoverflow.com/questions/1317448/how-to-create-a-delete-link-for-a-related-object-in-ruby-on-rails http://stackoverflow.com/questions/1317448/how-to-create-a-delete-link-for-a-related-object-in-ruby-on-rails these two links provide the solution about this kind of problem,i tried, but it doesnt work. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, could you post your controller code too? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/jaEELWsFplkJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Jan 26, 2012 at 3:19 AM, Daisy Di <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
What this probably means is that the javascript that handles your delete links is not being loaded. What version of Rails is this? I hit this issue a couple times with early iterations of Rails 3 before the asset pipeline kicked in. - Brian Haberer On Jan 26, 12:19 am, Daisy Di <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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. > > PS:http://stackoverflow.com/questions/1317448/how-to-create-a-delete-lin...http://stackoverflow.com/questions/1317448/how-to-create-a-delete-lin... > > these two links provide the solution about this kind of problem,i tried, > but it doesnt work. > > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Andre wrote in post #1042629:> Hi, could you post your controller code too?Hi, this is the destroy controller, i wont delete the record,just change the status to -1. def destroy @reservation = CrmRedemptionReservation.find(params[:id]) @reservation.update_attributes(:status_level => -1) #@reservation.destroy redirect_to redeemhistory_path end -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Jan 26, 2012 at 10:38 PM, Daisy Di <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Andre wrote in post #1042629: > > Hi, could you post your controller code too? > > Hi, this is the destroy controller, i wont delete the record,just change > the status to -1. > > def destroy > @reservation = CrmRedemptionReservation.find(params[:id]) > @reservation.update_attributes(:status_level => -1) > #@reservation.destroy > redirect_to redeemhistory_path > endWhy do you comment the line that destroy the reservation?... or your idea of destroy it is by changing its status? 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 26 January 2012 08:19, Daisy Di <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 ?Have you checked in log/development.log to see what is logged when you click the link? Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.