Tuesday, 15 April 2014

How do I display the name of a deleted element in Ruby on Rails? -


I have a simple rail application, where I am creating objects (like posts). So far, I can edit them one by one, but now I have a and lt;% = notice% & gt; After the echo the name of the deleted object confirmation of its extinction is it possible? If so, then how?

This is a very common thing in the railroad, and the idiomatic solution is to forward it

< P> Your administrator's destroyed action should look something like this:

  Delete the def = post = post.find (params [: id]) @ post.destroy Redirect_to posts_path, notice: "# {@ post.name}" has been deleted "end  

In your index action, you get the string generated in the last action to flash [: Notice] .


No comments:

Post a Comment