我有一个登录信息,保存新用户后应该发送一封电子邮件。这在本地工作正常,但在生产服务器上我不断在我的日志文件中收到此错误:
ArgumentError (wrong number of arguments (8 for 6)):
app/models/user_observer.rb:3:in `after_save'
/usr/lib64/ruby/1.8/observer.rb:185:in `notify_observers'
/usr/lib64/ruby/1.8/observer.rb:184:in `each'
/usr/lib64/ruby/1.8/observer.rb:184:in `notify_observers'
app/controllers/users_controller.rb:13:in `create'
我的user_observer:
class UserObserver < ActiveRecord::Observer
def after_save(user)
UserMailer.deliver_welcome_email(user)
end
end
我的user_mailer:
class UserMailer < ActionMailer::Base
def welcome_email(user)
recipients user.email
from "MilitaryMoveIt <militarymoveit@gmail.com>"
subject "Welcome to My Awesome Site"
sent_on Time.now
body :user => user
end
end
我的user_controller:
def create
@user = User.new(params[:user])
@user_session = UserSession.new
@user.level = 'Trial'
if @user.save
flash[:notice] = "Account registered!"
redirect_to account_url
else
render :layout => 'user_sessions_new', :template => 'user_sessions/new'
end
end
我真的很感激任何可以为我在这里缺少的东西发光的人。
编辑:这是传递的内容:
Processing UsersController#create (for 184.40.5.17 at 2010-08-06 12:38:23) [POST]
Parameters: {"user"=>{"name"=>"lauren", "password"=>"[FILTERED]", "login"=>"looloobs",
"email"=>"laurenrothlisberger@gmail.com"}, "x"=>"82", "y"=>"14", "action"=>"create",
"authenticity_token"=>"qvQLB9w/pJOWOFzKy6HadbxRieejhQ8Hmry36EAIIwc=", "controller"=>"users"}
Sent mail to laurenrothlisberger@gmail.com
我不知道X和Y参数是什么..这是问题,试图传递这些?
答案 0 :(得分:0)
如果它在本地工作但不在您的生产服务器上工作,那么两者的环境是否相同?相同的Ruby和Rails版本?
这两种环境有什么不同?