Thursday, 5 September 2013

Is it acceptable practice to add methods to the Rails::Application subclass?

Is it acceptable practice to add methods to the Rails::Application subclass?

I was thinking about being able to add an "application name" method to my
Rails::Application subclass, since the method that I had originally added
to a helper for ApplicationController is no longer visible to my
ActionMailer.
ActionView::Template::Error: undefined local variable or method `app_name'
for #<#<Class:0x44aba18>:0x449b8f0>
I haven't seen any reference to doing this in the standard rails
tutorials, and a few Google queries don't indicate best or even acceptable
practice.
I'd rather not have to hard code a lot of global application settings that
may be of value in the mailer templates.

No comments:

Post a Comment