Have a bit of a conundrum that I need to solve I would like to put this into environment.rb... config.action_mailer.default_url_options = { :host => Setting[:website_url] } but it obviously can''t read from the database before it is initialized and the configuration for action_mailer ''options'' apparently goes into environment.rb Is there someplace I can put this so that it loads after Rails is started? Craig -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sat, 2010-01-23 at 09:50 -0700, Craig White wrote:> Have a bit of a conundrum that I need to solve > > I would like to put this into environment.rb... > > config.action_mailer.default_url_options = { :host => > Setting[:website_url] } > > but it obviously can''t read from the database before it is initialized > and the configuration for action_mailer ''options'' apparently goes into > environment.rb > > Is there someplace I can put this so that it loads after Rails is > started?---- application_controller.rb but in this form... ActionMailer::Base.default_url_options[:host] = "example.com" Craig -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 23, 11:50 am, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote:> Have a bit of a conundrum that I need to solve > > I would like to put this into environment.rb... > > config.action_mailer.default_url_options = { :host => > Setting[:website_url] } > > but it obviously can''t read from the database before it is initialized > and the configuration for action_mailer ''options'' apparently goes into > environment.rb > > Is there someplace I can put this so that it loads after Rails is > started?Um, perhaps in the directory mentioned in your subject line? Files in config/initializers will be loaded after the Rails stack has been initialized. --Matt Jones -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sun, 2010-01-24 at 06:49 -0800, Matt Jones wrote:> > On Jan 23, 11:50 am, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote: > > Have a bit of a conundrum that I need to solve > > > > I would like to put this into environment.rb... > > > > config.action_mailer.default_url_options = { :host => > > Setting[:website_url] } > > > > but it obviously can''t read from the database before it is initialized > > and the configuration for action_mailer ''options'' apparently goes into > > environment.rb > > > > Is there someplace I can put this so that it loads after Rails is > > started? > > Um, perhaps in the directory mentioned in your subject line? Files in > config/initializers will be loaded after the Rails stack has been > initialized.---- indeed... putting it into /config/initializers/mailer.rb instead of /config/environment.rb allowed it to work. Thanks Craig -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.