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 example, if its the edit page, or the show page, etc. I’d like a different style for something – is there an if statement that can specify this?
(I need an if statement, because its used in a partial, on multiple pages).
Thanks!
Elliot
The
paramshash that is available in the controller contains:controllerand:actionkeys, which specify the controller and action names of the request.Therefore you could say