There might be a better way to do this, but I\'m trying to make an if statement in rails, based on the current action, in a controller (this will be used in a view).
For
The params
hash that is available in the controller contains :controller
and :action
keys, which specify the controller and action names of the request.
Therefore you could say
if params[:action] == "foo"
# Show stuff for action 'foo'
elsif params[:action] == "bar"
# Show stuff for action 'bar'
elsif ...
# etc.
end