Reputation: 2631
I am trying to figure out how to put Ruby code into a HAML file so I can determine which controller the request came through, and set some appropriate settings.
I added this code to the top of the file:
ruby:
active_is = "#{request[:controller]}/#{action_name}"
But it crashed with the error saying:
Illegal nesting: nesting within plain text is illegal.
Does that mean that my syntax is off? How do I fix this?
Thanks!
Upvotes: 0
Views: 2222
Reputation: 8101
Language filters are preceded by the colon, not the reverse:
:ruby
active_is = "#{request[:controller]}/#{action_name}"
More often than not, though, it's easier to just use -
:
- active_is = "#{request[:controller]}/#{action_name}"
Upvotes: 4