2011-09-18 4 views
0

레일 3.1을 Authlogic 3.0.3과 함께 사용하고 있습니다. 나는 내 응용 프로그램을 Heroku에 배포했습니다. 풀러의 스택 트레이스와Heroku의 인수 오류

ArgumentError (wrong number of arguments (3 for 2)): 
    app/controllers/application_controller.rb:38:in `current_user_session' 
    app/controllers/application_controller.rb:43:in `current_user' 
    app/controllers/application_controller.rb:5:in `block in <class:ApplicationController>' 

: 나는 다음과 같은 오류 얻을에게 Heroku에 배포 할 때 로컬, 모든하지만, 완벽하게 잘 작동

vendor/plugins/rpm/lib/new_relic/agent/instrumentation/rails3/active_record_instrumentation.rb:16:in `log_with_newrelic_instrumentation' 
.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:550:in `exec_query' 
.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:679:in `table_exists?' 
.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/attribute_methods/primary_key.rb:41:in `get_primary_key' 
.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/attribute_methods/primary_key.rb:25:in `reset_primary_key' 
.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/attribute_methods/primary_key.rb:16:in `primary_key' 
.bundle/gems/ruby/1.9.1/gems/authlogic-3.0.3/lib/authlogic/session/session.rb:48:in `session_credentials' 
.bundle/gems/ruby/1.9.1/gems/authlogic-3.0.3/lib/authlogic/session/session.rb:33:in `persist_by_session' 
.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/callbacks.rb:413:in `_run_persist_callbacks' 
.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/callbacks.rb:81:in `run_callbacks' 
.bundle/gems/ruby/1.9.1/gems/authlogic-3.0.3/lib/authlogic/session/callbacks.rb:90:in `persist' 
.bundle/gems/ruby/1.9.1/gems/authlogic-3.0.3/lib/authlogic/session/persistence.rb:55:in `persisting?' 
.bundle/gems/ruby/1.9.1/gems/authlogic-3.0.3/lib/authlogic/session/persistence.rb:39:in `find' 
app/controllers/application_controller.rb:38:in `current_user_session' 
app/controllers/application_controller.rb:43:in `current_user' 
app/controllers/application_controller.rb:5:in `block in <class:ApplicationController>' 

를이 예제로에 표시된 것 같이 내가 Authlogic 설정을 나는 간단한 인증이 필요하다.

class ApplicationController < ActionController::Base 
    protect_from_forgery 
    layout 'application' 
    before_filter { |c| Authorization.current_user = current_user } #this is line 5 

    helper_method :current_user, :current_user_session 

# erroneous stuff removed 

    private 
    def current_user_session 
    return @current_user_session if defined?(@current_user_session) 
    @current_user_session = UserSession.find #line 43 
    end 

    def current_user 
    return @current_user if defined?(@current_user) 
    @current_user = current_user_session && current_user_session.user #line 38 
    end 
end 

그리고 내 사용자 세션 : 사용자의 메소드를 호출

class UserSession < Authlogic::Session::Base 
    find_by_login_method :find_by_anything 
end 

:

class User < ActiveRecord::Base 
    attr_accessible :email, :password, :remember_me 

    acts_as_authentic do |c| 
    c.login_field = 'name' 
    c.require_password_confirmation = false 
    c.validates_format_of_login_field_options = {:with => /^[a-zA-Z0-9]+$/, :message => "should use only letters and numbers, no other characters."} 
    c.validates_length_of_login_field_options = {:within => 5..25} 
    end 

    def self.find_by_anything(login) 
    # Postgres and SQLite use a case sensitive search, so we need to make it case insensitive 
    find_by_smart_case_login_field(login) || find_by_email(login) 
    end 

내 생각은 UserSession.find가 있습니다 것을 이것은 내와 ApplicationController의 코드입니다 범인,하지만 내 인생이 그 문제를 해결할 수는 없어. 나는 이틀 동안 모든 것을 시도했지만 로그가 도움이되지 않아서 소스 코드를 탐색 할 수없는 것처럼 보입니다. 환경 간의 유일한 차이점은 로컬에서는 MySQL을 사용하고 있으며 heroku는 Postgres를 사용합니다.

EDIT : 문제는 Authlogic이 아니며 NewRelic입니다. 오류가 발생하여 Authlogic을 통해 명백해졌습니다. 솔루션에 대한 답변을 참조하십시오.

답변

0

ArgumentError가 NewRelic 애드온 때문인 것으로 나타났습니다. 이 문제가 발생하면 명령 줄로 이동하여 다음을 입력하십시오.

heroku addons:remove newrelic:standard --app your_app_name