2010-08-06 36 views
0

我有一个登录后,保存新用户应该发送电子邮件。这在当地工作正常,但在生产服务器上我不断收到这个错误在我的日志文件:ArgumentError与ActionMailer

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 <[email protected]>" 
    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"=>"[email protected]"}, "x"=>"82", "y"=>"14", "action"=>"create", 
"authenticity_token"=>"qvQLB9w/pJOWOFzKy6HadbxRieejhQ8Hmry36EAIIwc=", "controller"=>"users"} 
Sent mail to [email protected] 

我不知道X和Y参数..这就是问题所在,试图通过这些?

回答

0

如果它在本地工作,但不在生产服务器上工作,您是否具有相同的环境?相同的Ruby和Rails版本?

这两种环境有什么不同?

+0

这两个环境都运行相同版本的ruby和rails。谢谢 – looloobs 2010-08-07 13:44:59