Where have you defined those constants?

Constants should be accessed with NameOfTheClass::NAME_OF_THE_CONSTANT

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Tue, Feb 10, 2009 at 9:09 AM, Peter Hickman <[email protected]> wrote:
>
> Hi,
>
> I might be being a bit thick today but I have a problem that I can't
> seem to shake.
>
> I have some configuration data in a yaml file that I load with an
> initializer.
>
> AVATARS_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/avatars.yml")
>
> The information includes where to save upload files and other stuff so
> it is needed in several places. One of the controllers can reference
> AVATARS_CONFIG, but the model, avatars.rb cannot. So I have to have
> the same line in any controller or model that needs it. Which looks to
> be very messy not to mention inconsistent - some places need it, other
> don't.
>
> I've tried to make them global, ie $AVATARS_CONFIG, but it doesn't
> seem to work.
>
> Anyone have any idea how I might get this and other constants I
> require to be available globally?
>
> Thanks
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to