dimanche 8 mars 2015

Rails 4: syntax error, unexpected tIVAR, expecting keyword_do or '{' or '('


Vote count:

0




Want to send an email via mandrill when a user signs up for a new account. Have registered with Mandrill,they can reset passwords but when they create an account they get errors


syntax error, unexpected tIVAR, expecting keyword_do or '{' or '(' in the user.rb file


user.rb file



class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable

has_many :articles


after_create :send_notification

def send_notification
**AdminMailer.new_user(self).deliver**<- error
end

end


adminmailer.rb



class AdminMailer < ActionMailer::Base
default from: "no-reply@example.com"
default to: hello@hello.com

def new_user(user)
@user = user
mail(subject: 'New User: #{user.email}')
end
end


new_user.html.erb



<h1><%= @user.email %></h1>


asked 1 min ago

Neil

95






Rails 4: syntax error, unexpected tIVAR, expecting keyword_do or '{' or '('

Aucun commentaire:

Enregistrer un commentaire