rails howto use environment constant in models and views?
Posted
by fenec
on Stack Overflow
See other posts from Stack Overflow
or by fenec
Published on 2010-05-25T15:56:49Z
Indexed on
2010/05/25
16:11 UTC
Read the original article
Hit count: 212
ruby-on-rails
|ruby
i have my constants initialized in environment.rb like this :
Rails::Initializer.run do |config|
...
MAX_BID = 10
end
i would like to use this constant in my models and views,what is the correct syntax? if a use it a model its says
NameError: uninitialized constant User::MAX_BID
i understand that it is looking for the constant inside the model , how can i tell explicitly that this constant is in the environment? thanks
© Stack Overflow or respective owner