which action?

Hi,

I've got a partial that I call from more than one view. I need it to be slightly different when called from one of the views. Does rails set a variable to tell the partial which action or view is calling it, and if so, how?

Thank you.

Regards, Rich

You can get the action from the params hash, params[:action]

Duzenbury, Rich wrote:

Hi,

<%= controller.action_name %>

Thanks.

Regards, Rich

You've figured out how to get the action name, but I would suggest that this technique tends to make your code very "brittle". A better approach might be to pass a variable to the partial through the call to render() using the :locals option.