Erwin
2011-Mar-04 15:33 UTC
How to modify the template path for ActionMailer used in a Ruby script ?
I am testing a ruby 1.9.2 script (it''ll be run in a cron task later...) in which I am trying to use ActionMailer All my files are in a single folder ''joinus_email - joinus_email joinus_email.rb notifier.rb - notifications joinus_email.html.erb joinus_email.text.erb running the script joinus_email.rb, (in which I defined the ActionMailer::Base.smtp_settings) mail = Notifier.joinus_email("john.doe-PV5Ro7/Mrj4@public.gmane.org").deliver is raising an exception : exception: Missing template notifier/joinus_email with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en]} in view paths notifier.rb class Notifier < ActionMailer::Base default :from => "system-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org" def joinus_email(destination, coupon) @url = "http://example.com" mail(:template_path => ''notifications'', :to => destination, :subject => "Welcome") do |format| format.html format.text end end end I believe there is something wrong with the :template_path => ''notifications'' parameter... I tried a relative path : " ./notifications" same error raised I also tried to define upon initialization : TEMPLATE_ROOT = "./ notifications" in the joinus_email.rb script , same error raised ... any suggestions ? -- 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.
Erwin
2011-Mar-04 15:58 UTC
Re: How to modify the template path for ActionMailer used in a Ruby script ?
[SOLVED] using ActionMailer::Base.prepend_view_path(''./'') and changing the notifications folder name to notifier On 4 mar, 16:33, Erwin <yves_duf...-ee4meeAH724@public.gmane.org> wrote:> I am testing a ruby 1.9.2 script (it''ll be run in a cron task > later...) in which I am trying to use ActionMailer > All my files are in a single folder ''joinus_email > > - joinus_email > joinus_email.rb > notifier.rb > - notifications > joinus_email.html.erb > joinus_email.text.erb > > running the script joinus_email.rb, (in which I defined the > ActionMailer::Base.smtp_settings) > mail = Notifier.joinus_email("john....-PV5Ro7/Mrj4@public.gmane.org").deliver > > is raising an exception : > exception: Missing template notifier/joinus_email with > {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en]} > in view paths > > notifier.rb > class Notifier < ActionMailer::Base > default :from => "sys...-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org" > def joinus_email(destination, coupon) > @url = "http://example.com" > mail(:template_path => ''notifications'', :to => > destination, :subject => "Welcome") do |format| > format.html > format.text > end > end > end > > I believe there is something wrong with the :template_path => > ''notifications'' parameter... > I tried a relative path : " ./notifications" same error raised > I also tried to define upon initialization : TEMPLATE_ROOT = "./ > notifications" in the joinus_email.rb script , same error raised ... > > any suggestions ?-- 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.