This occurs as a result of using the convenience method
''config'' that
I''ve used to allow users to override default Engine configurations -
that the point your environment files are being loaded, this method
doesn''t yet exist.
One way of getting around this is not to use the ''config''
method in
files that will be loaded before the Rails Initializer completes
loading plugins. You could do this by directly accessing the CONFIG
hash for the module (the config() method creates this hash behind the
scenes if it doesn''t already exist) , e.g in
environments/development.rb:
module LoginEngine
CONFIG = {} # it won''t exist yet, so define it
CONFIG[:app_name] = "My application"
CONFIG[:admin_email] = "debug@localhost"
end
For more information about config(), please look at the Rails Engines
documentation (or infact the code, RDoc seems to have some issues
finding the Engines module because of the weird things we''ve had to do
to get it loaded in the right namespace when its being loaded as a
plugin).
The config() method exists to let Engine developers set configuration
values within their engines and have those values used *only* if the
user hasn''t already provided a value. It''s not spectacular, so
there
could easily be better ways of doing this type of thing, and of course
I''m eager to hear any suggestions..... :)
Thanks for finding this gotcha though, François!
- james
On 11/3/05, Francois Beausoleil
<francois.beausoleil-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hello everyone,
>
> I just wrote an article on my blog about Rails Engine configurations:
> http://rubyurl.com/eWL
> http://blog.teksol.info/articles/2005/11/03/rails-engine-configuration-woes
>
> My problem was that I tried to set different configurations depending
> on whether I was in production or development/test environment. Rails
> would complain badly on server startup if I was doing any
> configuration in development.rb.
>
> The solution ? Do all configuration from environment.rb, and put a
> case around the optional parts. I am open to suggestions, though.
>
> Bye !
> --
> François Beausoleil
> http://blog.teksol.info/
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>