mad_mimi_mailer icon indicating copy to clipboard operation
mad_mimi_mailer copied to clipboard

NoMethodError: undefined method `subject'

Open conradwt opened this issue 13 years ago • 5 comments

Hi, I'm started to see the following messages with Ruby 1.9.3. Did the API change. Here's my mailer:

users_mailer.rb:

class UsersMailer < MadMimiMailer

  def update_project_confirmation( user, project )
    subject         "#{ActionMailer::Base.default_url_options[:host]} - Thank you for updating your project"
    from              "[email protected]" 
    recipients    user.email

    body :full_name => user.name, :project_name => project.name
  end

end

Error:

1.9.3p196 :002 > UsersMailer.deliver_update_project_confirmation( project.user, project )
  User Load (37.9ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
NoMethodError: undefined method `subject' for #<UsersMailer:0x007fb142078668>
    from /Users/conradwt/rails.dir/projects/catarse/app/mailers/users_mailer.rb:22:in `update_project_confirmation'
    from /Users/conradwt/.rvm/gems/ruby-1.9.3-head/bundler/gems/mad_mimi_mailer-80c2ee30a10a/lib/mad_mimi_mailable.rb:65:in `deliver_mimi_mail'
    from /Users/conradwt/.rvm/gems/ruby-1.9.3-head/bundler/gems/mad_mimi_mailer-80c2ee30a10a/lib/mad_mimi_mailable.rb:57:in `method_missing'
    from (irb):2
    from /Users/conradwt/.rvm/gems/ruby-1.9.3-head/gems/railties-3.2.3/lib/rails/commands/console.rb:47:in `start'
    from /Users/conradwt/.rvm/gems/ruby-1.9.3-head/gems/railties-3.2.3/lib/rails/commands/console.rb:8:in `start'
    from /Users/conradwt/.rvm/gems/ruby-1.9.3-head/gems/railties-3.2.3/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

conradwt avatar May 05 '12 09:05 conradwt

I'm seeing this too. But for me it's balking at the 'from" method. I imagine it just has to do with which method you call first, though. I'm thinking this has to do with the refactored Mailer in Rails 3.1 or 3.2 and the ridiculously out of date MadMimiMailer gem. Did you learning anything new on how to fix the issue, conradwt?

pdobb avatar Jul 18 '12 19:07 pdobb

@pdobb I decided to move away from the MadMimiMailer and use the MadMimi Ruby gem with Rails.

conradwt avatar Jul 20 '12 00:07 conradwt

@conradwt thanks. I ended up following a somewhat similar path. I actually forked the mail-mad_mimi gem and got it working with Rails 3.2.6 and Ruby 1.9.3 with standard ActionMailer synatx. My fork is at https://github.com/pdobb/mail-mad_mimi if anyone is in the same boat.

pdobb avatar Jul 20 '12 20:07 pdobb

@pdobb Nice work. I went this path because the engineers at MadMimi were more intimate with their own Ruby gem and my client was using their service to delivery e-mails. Also, I'm in the process of moving e-mail delivery into their own external service which will be separate from the core Rails application. Lastly, I would recommend becoming the maintainer of the gem, bump the version, and make it available on rubygems.org. I forgot to mention that you might also want to let madmimi.com know about the existence of the gem so that their clients using Rails can benefit from it.

conradwt avatar Jul 20 '12 21:07 conradwt

You will need to add { and } around that block and subject: or :subject =>

deyandimitrov avatar Nov 05 '13 14:11 deyandimitrov