Christian Neuhaus
2006-Jan-26 09:50 UTC
[Rails] Newbe:Where declare constants visible in view & controller ?
I am using some constants that should be visible in the controller and in a view. Declaring the constant in the controller does not make the constant visible in the view. So my question: Where can I declare the constant to be visible in all views and controllers ? Thanks a lot in advance Christian -- Posted via http://www.ruby-forum.com/.
Christian Neuhaus
2006-Jan-27 08:15 UTC
[Rails] Re: Newbe:Where declare constants visible in view & controll
Hi, I know its a simple question - but maybe someone can help :-) Thanks Christian Christian Neuhaus wrote:> I am using some constants that should be visible in the controller and > in a view. > > Declaring the constant in the controller does not make the constant > visible in the view. > > So my question: > Where can I declare the constant to be visible in all views and > controllers ? > > Thanks a lot in advance > Christian-- Posted via http://www.ruby-forum.com/.
Tom Mornini
2006-Jan-27 17:16 UTC
[Rails] Re: Newbe:Where declare constants visible in view & controll
Set a instance attribute in the controller via before_filter. -- -- Tom Mornini On Jan 27, 2006, at 12:15 AM, Christian Neuhaus wrote:> Hi, > I know its a simple question - but maybe someone can help :-) > Thanks > Christian > > Christian Neuhaus wrote: >> I am using some constants that should be visible in the controller >> and >> in a view. >> >> Declaring the constant in the controller does not make the constant >> visible in the view. >> >> So my question: >> Where can I declare the constant to be visible in all views and >> controllers ? >> >> Thanks a lot in advance >> Christian > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Ezra Zygmuntowicz
2006-Jan-27 17:55 UTC
[Rails] Re: Newbe:Where declare constants visible in view & controll
On Jan 27, 2006, at 12:15 AM, Christian Neuhaus wrote:> Hi, > I know its a simple question - but maybe someone can help :-) > Thanks > Christian > > Christian Neuhaus wrote: >> I am using some constants that should be visible in the controller >> and >> in a view. >> >> Declaring the constant in the controller does not make the constant >> visible in the view. >> >> So my question: >> Where can I declare the constant to be visible in all views and >> controllers ? >> >> Thanks a lot in advance >> ChristianChristain- I usually put my constants in the environment.rb file. This way they will be available everywhere in the whole app. just remember to restart the webserver after makig changes to them. Cheers- -Ezra Zygmuntowicz Yakima Herald-Republic WebMaster http://yakimaherald.com 509-577-7732 ezra@yakima-herald.com