Yes, there are controller_name and action_name helpers defined for the 
controller; I believe they're both directly accessible from the views, 
but if not, you can use controller.controller_name and 
controller.action_name. That said, Haml already defines a helper 
somewhat like you're describing, but for the class attribute. It's 
called page_class, and just returns the controller name followed by a 
space followed by the action name. I think this works better as a class, 
so you can set styles for the whole controller as well as specific actions.

- Nathan

weepy wrote:
> Hi
>
> Is there a way to know the controller and action names from a view ?
>
> It would be quite cool to be able to do
>
> %body{:id => controller + "_" + "action"}
>
> So you could then write Sass to overwrite specific CSS for particular
> pages.
>
> #users_show
>   p
>      color: red
>
> *...(
>
>
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to