Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `subject' #9

Open
conradwt opened this issue May 5, 2012 · 5 comments
Open

NoMethodError: undefined method `subject' #9

conradwt opened this issue May 5, 2012 · 5 comments

Comments

@conradwt
Copy link

conradwt commented May 5, 2012

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>'
@pdobb
Copy link

pdobb commented Jul 18, 2012

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?

@conradwt
Copy link
Author

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

@pdobb
Copy link

pdobb commented Jul 20, 2012

@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.

@conradwt
Copy link
Author

@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.

@deyandimitrov
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants