Ruby Forum Ruby on Rails > Activerecord Mailing (ar_mailer)

Posted by Juanma Cervera (jmcervera)
on 26.09.2007 23:43
I am trying to run ar_mailer for mass mailings, but I can“t get my
server started after adding the sentence
    require 'action_mailer/ar_mailer'
in environment.rb

I am using Windows XP, Ruby 1.8.6, and Rails 1.2.3/Edge Rails.
This is the error I get


** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
C:/Documents and
Settings/jmcervera/work/project1/vendor/rails/actionmailer/lib/../../actionpack/lib/../../activesupport/lib/active_support/dependencies.rb:477:in
`const_missing': uninitialized constant ActionMailer::ARMailer::Email
(NameError)
  from
c:/ruby/lib/ruby/gems/1.8/gems/ar_mailer-1.3.1/lib/action_mailer/ar_mailer.rb:70
  from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in
`gem_original_require'
  from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in
`require'
  from C:/Documents and
Settings/jmcervera/work/project1/config/environment.rb:14
  from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
  from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
  from
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/mongrel/rails.rb:155:in
`rails'
  from
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/mongrel_rails:112:in
`cloaker_'
   ... 9 levels...
  from c:\ruby\bin\mongrel_rails:16:in `load'
  from c:\ruby\bin\mongrel_rails:16
  from -e:2:in `load'
  from -e:2


I have the same error, even trying to do that require in irb.

Does this gem works with Windows XP?

Thanks in advance.

Juanma Cervera
Posted by Juanma Cervera (jmcervera)
on 27.09.2007 10:53
Well. It seems that the problem has nothing to do with windows XP.
Maybe the problem is with Edge Rails.
Now, I have moved the sentence require 'action_mailer/ar_mailer' to 
config/environments/*.rb instead of config/environment.rb and the server 
starts.
But now, as soon as I change the base class of the mailer classes to 
ActionMailer::ARMailer the template file could not be finded by 
ActionVier.

This is the error I get. 'prueba' is the name of template in this case.

Couldn't find template file for prueba in "/ventas_mailer"

vendor/rails/actionpack/lib/action_view/base.rb:282:in `render_file'
vendor/rails/actionpack/lib/action_view/base.rb:318:in `render'
vendor/rails/actionmailer/lib/action_mailer/base.rb:483:in `render'
vendor/rails/actionmailer/lib/action_mailer/base.rb:478:in 
`render_message'
vendor/rails/actionmailer/lib/action_mailer/base.rb:426:in `create!'
vendor/rails/actionmailer/lib/action_mailer/base.rb:387:in `initialize'
vendor/rails/actionmailer/lib/action_mailer/base.rb:335:in `new'
vendor/rails/actionmailer/lib/action_mailer/base.rb:335:in 
`method_missing'
app/models/venta.rb:43:in `reclamacion_pendientes_dia_26'
app/models/venta.rb:41:in `each'
app/models/venta.rb:41:in `reclamacion_pendientes_dia_26'
app/controllers/ventas_pendientes_controller.rb:90:in `notificar_26'
app/controllers/ventas_pendientes_controller.rb:40:in `submit_form'
-e:2:in `load'
-e:2

Any help?

Juanma Cervera
Posted by Rails Terrorist (malioboro)
on 08.04.2008 08:46
I have the problem like it before. What I do is :

1. Re-install Gem
2. do script/mailer again, but do not replace model
3. restart my server
4. Back working :)

Enjoy,
Reinhart
{$_$} http://teapoci.blogspot.com