Hey guys! I’m getting a problem that is driving me crazy.
I defined an instance variable inside my ApplicationController:
def initialize
@stylesheets = []
end
When I try to access it from a view, say SomeNamespace::SiteSection (index.html.erb):
<% @stylesheets << "some-stylesheet" %>
<h1>Blablabla</h1>
the instance variable @stylesheets isn’t visible, i.e., ruby says it wasn’t defined.
So, how I make this instance variable visible inside the views?
Thanks in advance.
Additional info:
- I’m using ruby 1.9.2 with rails 3.0.4
- I’m using namespaces (the
ApplicationControllerisn’t namespaced)
1 Answer