2
votes

I'm building a Rails Engine and right now I set all my configuration variables in config/environments/development.rb (within the engine itself, i can also overwrite it from the application later) and can access it from the application with ::Rails.application.config.my_item

This file is getting big and some variables such as config.title = 'Lambda Website' could be placed somewhere else, I was thinking to make a config/settings/my_file.rb and just include it to be able to call it the same way as the development.rb variables but it's more complicated than I expected ... I tried a couple of gems that didn't work at all, maybe because it's an engine. I also tried to require files but it blows up too.

How can I simply split this configuration file easily ? Is there an easy way to include configuration files within an engine ? Both YAML/ERB solution are welcome ...

Thank you guys ;)

1

1 Answers

1
votes

Inside your

app/config/initializerz/custom_setting.rb

#custom_setting.rb
YOUR_CONSTANT = WHATEVER

Then feel free to use this constant this anywhere in your app.