문제를 발견했습니다. Authlogic의 lib/authlogic/acts_as_authentic/base.rb
에서이 조각 봐 : column_names
오류가 발생
private
def db_setup?
begin
column_names
true
rescue Exception
false
end
end
경우, db_setup?
는 false를 돌려줍니다. base.rb
에서도이 다른 기능을 봐 :
def acts_as_authentic(unsupported_options = nil, &block)
# Stop all configuration if the DB is not set up
raise StandardError.new("You must establish a database connection before using acts_as_authentic") if !db_setup?
raise ArgumentError.new("You are using the old v1.X.X configuration method for Authlogic. Instead of " +
"passing a hash of configuration options to acts_as_authentic, pass a block: acts_as_authentic { |c| c.my_option = my_value }") if !unsupported_options.nil?
yield self if block_given?
acts_as_authentic_modules.each { |mod| include mod }
end
db_setup?
false를 반환하는 경우, Authlogic가 column_names
에 의해 throw 예외, 하지만 같은 예외가 발생합니다.
내 문제는 column_names
이 예외 던지고이었다 내 사용자 테이블이 없습니다 users
, user
라고되어
/Users/jason/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.2.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1106:in `async_exec': PG::Error: ERROR: relation "users" does not exist (ActiveRecord::StatementInvalid)
LINE 4: WHERE a.attrelid = '"users"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"users"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
그리고 그 예외에 대한 이유를하지만, 레일이 제대로 설정 내 pluralize_table_names
에 따기되지 않았습니다 . pluralize_table_names
문제 (이 설정이 작동하는 방식이 Rails 3.1에서 변경된 것 같습니다)를 수정하면 Authlogic 문제가 사라졌습니다. 그래서
이 문제가 발생하는 경우, 당신이 시도 할 수 있습니다 : (Authlogic의 로컬 버전을 사용하도록 Gemfile을 변경 dev에 기계
어딘가에에 Authlogic의 REPO를
- 복제를
'authlogic', :path => '/path/to/authlogic'
)
- 은 다른 잠재적 m를 얻는 경우에 참조
begin
/rescue
/end
절
- 외부
db_setup?
에 column_names
호출을 추가 광산 정확하고 유익한, 오류, 내가 한 것처럼
이전에는 큰 authlogic 팬이었고 LDPA, RPX 등의 어댑터를 포함하여 2.x 시대에 많은 앱을 사용했습니다. 이후 대부분을 3.0.x 및 3.2로 업그레이드했지만 그 과정에서 전반적으로 더 쉽게 마이그레이션 할 수 있다고 결정했습니다. 쉽고 코드가 더 깨끗합니다 (일반적으로 3.0 시대에 설계 되었기 때문에). 이것은 귀하의 질문에 대답하지 않습니다 .. 난 그냥 그것을 언급 authlogic 다시 물고 유지하는 경우 명심하십시오; 장치로 전환하는 것은 그리 큰 문제가 아니며, 기본으로 자리 잡기 위해 오래 걸리지 않을 것입니다. – tardate
나는 결국 다른 날 Devise로 전환했다. 그것은 놀라 울 정도로 쉽고 고통없는 스위치였습니다. –
이것은 수정 된 것 같습니다. 우선 master 브랜치에서 pull하기 위해'gem 'authlogic, : git =>'git : // github.com/binarylogic/authlogic.git''을 gemfile에 사용해야합니다. –