I'm trying to make a delete button for child objects. When the button
is pressed, I want the view to stay the same to protect whatever data
the user has entered already. When the button is pressed, it should
prompt "Are you sure?" and get an answer. I have most of this set
already, but I can't find a way to keep things from leaving the view.

Here's my code
controller>
def destroy
person = Person.find(params[:id])
person.destroy
redirect_to(households_url) ---problem here,
but I have no idea what to put in it's place
end


view>
<td><% if !person_form.object.new_record? %>
<%= person_form.hidden_field :id, :index => nil %>
<%= link_to 'Delete', person_path(person.id), :confirm => 'Are you
sure?', :method => :delete %>
<% end %></td>


By the way, I'm running Rails 2.3.9 at the moment.

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

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 5 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 24, '12 at 8:44p
activeFeb 24, '12 at 10:01p
posts5
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase