I have a page containing 3 views (2 are partials). One of the partials
needs to have a button that will clear a table called “messages” in the
database.
I can put a button like this “<%= button_to “Clear Messages”, :action =>
‘clear_messages’ %>” and have the controller do “Message.delete_all”.
But the problem is that the controller would want to render a view, and
I don’t want that to happen. I just want a particular action to occur in
the backend without any changes to the page.
Actually I would need such buttons for other purposes too, but if I know
how to do the above example I could do the rest.