On Wednesday, 18 November 2015 09:48:38 UTC, ruud wrote:
> Hi Matt,
> thanks for your advice. Maybe this is an alternative in this case, but I
> would like to know how to tackle this for custom functions in general.
> I found out that if I copy the function to config/application, rake finds
> it. If it is the proper solution for yml-helper functions I don't know.
> Maybe someone has advice on this.
>
>
Not exactly the same thing but I have a config/storage.yml file for holding
my S3 configuration - and I load it in config/initializers/storage.rb -
load the YAML as a text file, use ERB to parse it and then apply the file.
So any functions I had defined within config/initializers/storage.rb
should be available to the ERB parser.
contents = File.open(File.join(Rails.root, 'config', 'storage.yml')) { | f
| f.read }
contents = ERB.new(contents).result
yaml = YAML.load(contents)
AqrReports::Application.config.image_options = yaml['images'][Rails.env]
AqrReports::Application.config.file_options = yaml['files'][Rails.env]
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/7aaa930a-2652-4369-bdf8-61e167179303%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.