Fedena undefined method `name' for actionmailer:String on ubuntu 14.04 LTS
Problem solved
removed rubygems-update 2.4.2
and installed 1.6.2
and wow.
`method_missing': undefined method `mail' for Emailer:Class (NoMethodError)
Didn't have a yahoo account to check, but this configuration has worked with my gmail account:
require 'action_mailer'
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:authentication => :plain,
:user_name => "sender@gmail.com",
:password => "<password>",
:enable_starttls_auto => true
}
class Emailer < ActionMailer::Base
def test_email(email_address, email_body)
mail(to: email_address, from: 'sender@gmail.com', subject: 'action mailer test', body: email_body)
end
end
Emailer.test_email('recipient@gmail.com', 'This is a test e-mail!').deliver_now
update_rubygems throws undefined method `find_by_path' for Gem::Specification:Class (NoMethodError)
Downgrading my Ruby version to 1.8.7 solved this problem.
Getting undefined method `name' for actionmailer:String when installing Webistrano
This worked for me.
rvm rubygems 1.6.2
Rails NoMethodError (undefined method `humanize' for nil:NilClass) in mail to:
Several suggestions:
- You should use ActionMailer class methods directly instead of instantiating a new mailer with
new
. This is probably the source of the bug - Since your
NewAnswerNotify
is nested underServices
, it would also make it less ambiguous to use the root namespace::NewAnswerNotifyMailer
(some people may disagree with me on this one, but I've had so many root namespace bugs in the past that I tend to systematically use the::
prefix now) - Beware of class loading that works differently for
class Services::NewAnswerNotify
andmodule Services class NewAnswerNotification
(lots of existing questions on this topic)
module Services
class NewAnswerNotify
def send_notify(answer)
::NewAnswerNotifyMailer.notify(answer).deliver_now # instead of .new.notify
end
end
end
Also some side comments regarding the variables and the english
I would rather use
Services::NewAnswerNotification
NewAnswerNotificationMailer
def send_notification(answer)
ordef notify(answer)
And maybe one last piece of advice from experience after maintaining a code base in the long run: to be more explicit regarding who you are notifying of what def notify_question_author_of_new_answer
because later you might have a notify_question_subscribers_of_new_answer
or someone else who might need to be notified (it totally depends on your business model of course, feel free to ignore this remark)
undefined method `before_action' for ActionMailer
There's no callbacks for ActionMaler::Base in Rails 3
Related Topics
Error Install Rubyracer with Error "Invalid Gem: Package Is Corrupt"
Ruby Operator Method Calls VS. Normal Method Calls
How to Remove Duplicates in a Hash in Ruby on Rails
Can You Install Documentation for Existing Gems
How to Fix an Accidental 'Sudo Bundle Install Dir_Name'
How to Fix a Bundle Install "Nio4R Error" on Rails 5.0.0
Using Compass from Ruby (Not Shell)
Scaffolding Activerecord: Two Columns of the Same Data Type
How to Remove Non-Printable/Invisible Characters in Ruby
Stop Loading Page Watir-Webdriver
Change Default Date Format in Ruby on Rails
Using Phonegap as a Native Container for a Rails 3 App
Ruby-Rails Serve Ftp File Direct to Client