I have an e-mail-type app where users will see either a list of message
headers, or a single message. From either view, they need to be able to
delete a message.
When delete is called from the list view, I use :loading =>
visual_effect(:fade, ‘my_id’), then in the controller the record is
actually deleted and nothing needs to be rendered back. This works
fine.
However, if delete is called from the expanded message view, I need the
controller to render the list of messages again.
Any suggestions on how I can either tell from the controller where a
request came from, or else pass something with the link_to_remote? Is
there a :locals parameter? It doesn’t make sense to have 2 methods in
the controller - say a delete_from_list and delete_from_message.
In your controller, you can access params[:del_type] and it will either
be ‘list’ or ‘message’ and you can act accordingly.
c.
cliffeh wrote:
I have an e-mail-type app where users will see either a list of message
headers, or a single message. From either view, they need to be able to
delete a message.
When delete is called from the list view, I use :loading =>
visual_effect(:fade, ‘my_id’), then in the controller the record is
actually deleted and nothing needs to be rendered back. This works
fine.
However, if delete is called from the expanded message view, I need the
controller to render the list of messages again.
Any suggestions on how I can either tell from the controller where a
request came from, or else pass something with the link_to_remote? Is
there a :locals parameter? It doesn’t make sense to have 2 methods in
the controller - say a delete_from_list and delete_from_message.
Thanks,
Cliffe
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.