Forum: Ruby on Rails Newbe:Where declare constants visible in view & controller ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C591df8c5b86e0ff3a93ae55d161d002?d=identicon&s=25 Christian Neuhaus (cneuhaus)
on 2006-01-26 10:50
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
C591df8c5b86e0ff3a93ae55d161d002?d=identicon&s=25 Christian Neuhaus (Guest)
on 2006-01-27 09:15
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
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-01-27 18:18
(Received via mailing list)
Set a instance attribute in the controller via before_filter.

--
-- Tom Mornini
132a94ca65959bda6c74fae54bff2425?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-01-27 18:58
(Received via mailing list)
On Jan 27, 2006, at 12:15 AM, Christian Neuhaus wrote:

>> 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


Christain-

	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
This topic is locked and can not be replied to.