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.
Christian N. (Guest)
on 2006-01-26 11: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
Christian Neuhaus (Guest)
on 2006-01-27 10: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
Tom M. (Guest)
on 2006-01-27 19:18
(Received via mailing list)
Set a instance attribute in the controller via before_filter.

--
-- Tom M.
Ezra Z. (Guest)
on 2006-01-27 19: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 Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
removed_email_address@domain.invalid
This topic is locked and can not be replied to.