2013-11-14 2 views
0

설치 프로그램을 실행하면 다음과 같이 표시됩니다. 결과물은 외래 키와 반성에 대한 불만과 함께 이상합니다. source_reflection은 nil입니까? 수정에 관한 어떤 생각?초기화 도구 설치시 반사 오류가 발생하는 rails_admin

또한, S.O. 이 양식을 채우기 위해 추가 드리블을 추가하지 않으면이 질문을 게시하지 않으므로 정말 짜증이납니다. S.O !!!

- Hello, RailsAdmin installer will help you set things up! 
     - I need to work with Devise, let's look at a few things first: 
     - Checking for a current installation of devise... 
     - Found it! 
     - Looks like you've already installed it, good! 
     ? Where do you want to mount rails_admin? Press <enter> for [admin] > 
    gsub config/routes.rb 
    route mount RailsAdmin::Engine => '/admin', :as => 'rails_admin' 
     - And you already set it up, good! We just need to know about your user model name... 
     - We found 'user' (should be one of 'user', 'admin', etc.) 
     ? Correct Devise model name if needed. Press <enter> for [user] > admin 
     - Now setting up devise with user model name 'admin': 
generate devise 
    invoke active_record 
    create db/migrate/20131114155103_add_devise_to_admins.rb 
    insert app/models/admin.rb 
    route devise_for :admins 
     - Now you'll need an initializer... 
    create config/initializers/rails_admin.rb 
/Users/JCC/.rvm/gems/[email protected]/gems/activerecord-4.0.0/lib/active_record/reflection.rb:401:in `rescue in foreign_key': ActiveRecord::Reflection::ThroughReflection#foreign_key delegated to source_reflection.foreign_key, but source_reflection is nil: #<ActiveRecord::Reflection::ThroughReflection:0x007f87de0c5bd0 @macro=:has_many, @name=:transactions, @scope=nil, @options={:through=>:locatables}, @active_record=Address(id: integer, street: string, city: string, state: string, zip: string, country: string, created_at: datetime, updated_at: datetime, latitude: float, longitude: float), @plural_name="transactions", @collection=true, @source_reflection_names=[:transaction, :transactions], @through_reflection=#<ActiveRecord::Reflection::AssociationReflection:0x007f87dafbb670 @macro=:has_many, @name=:locatables, @scope=nil, @options={}, @active_record=Address(id: integer, street: string, city: string, state: string, zip: string, country: string, created_at: datetime, updated_at: datetime, latitude: float, longitude: float), @plural_name="locatables", @collection=true, @foreign_key="address_id", @class_name="Locatable", @klass=Locatable(id: integer, owner_id: integer, owner_type: string, address_id: integer, created_at: datetime, updated_at: datetime, pickup: boolean, kind: string)>, @source_reflection=nil> (RuntimeError) 
    from /Users/JCC/.rvm/gems/[email protected]/gems/activerecord-4.0.0/lib/active_record/reflection.rb:397:in `foreign_key' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/adapters/active_record.rb:306:in `association_foreign_key_lookup' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/adapters/active_record.rb:72:in `block in associations' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/adapters/active_record.rb:65:in `map' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/adapters/active_record.rb:65:in `associations' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/config/fields/factories/association.rb:6:in `block in <top (required)>' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/config/fields.rb:54:in `call' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/config/fields.rb:54:in `block (2 levels) in factory' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/config/fields.rb:54:in `each' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/config/fields.rb:54:in `find' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/config/fields.rb:54:in `block in factory' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/config/fields.rb:50:in `each' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/config/fields.rb:50:in `factory' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/config/has_fields.rb:130:in `_fields' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/config/has_fields.rb:128:in `_fields' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/config/has_fields.rb:108:in `all_fields' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/rails_admin/config/has_fields.rb:83:in `fields' 
    from (erb):64:in `block in template' 
    from (erb):53:in `map' 
    from (erb):53:in `template' 
    from /Users/JCC/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/erb.rb:849:in `eval' 
    from /Users/JCC/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/erb.rb:849:in `result' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/actions/file_manipulation.rb:117:in `block in template' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/actions/create_file.rb:54:in `call' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/actions/create_file.rb:54:in `render' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/actions/create_file.rb:63:in `block (2 levels) in invoke!' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/actions/create_file.rb:63:in `open' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/actions/create_file.rb:63:in `block in invoke!' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/actions/empty_directory.rb:117:in `call' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/actions/empty_directory.rb:117:in `invoke_with_conflict_check' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/actions/create_file.rb:61:in `invoke!' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/actions.rb:95:in `action' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/actions/create_file.rb:26:in `create_file' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/actions/file_manipulation.rb:116:in `template' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/rails_admin-0.5.0/lib/generators/rails_admin/install_generator.rb:75:in `install' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/command.rb:27:in `run' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `block in invoke_all' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `each' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `map' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `invoke_all' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/group.rb:233:in `dispatch' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/thor-0.18.1/lib/thor/base.rb:439:in `start' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/railties-4.0.0/lib/rails/generators.rb:156:in `invoke' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/railties-4.0.0/lib/rails/commands/generate.rb:11:in `<top (required)>' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require' 
    from /Users/JCC/.rvm/gems/[email protected]/gems/railties-4.0.0/lib/rails/commands.rb:49:in `<top (required)>' 
    from bin/rails:4:in `require' 
    from bin/rails:4:in `<main>' 

답변

0

이 오류는 나에게 밖으로 걸립니다. 다른 외부 응답뿐만 아니라 다른 SO 응답은 저에게 오류를주는 것에 대한 단서를주었습니다. 그게 여기에있다 reflection error with polymorphic association

나에게 도움이 된 다른 사람은 당신이 연계를 더 명확하게 할 필요가 있다는 것을 이해해야한다. 또는이 경우, 레일즈 관리자는 제시하기 위해 모든 관계를 알아야한다. 관리자에게. :source options in rails

문제는 소스의 레일에 명확하지 않은 다형성 연관성이 있다는 것이 었습니다. 일단 레일 관리자의 혼란을 없애고 나면 오류없이 진행할 수있었습니다. 노트의

두 항목 : 이미 유증와 관리자 클래스를 만든 경우

  1. , 편집하거나 자동으로 레일 관리자에 의해 생성 된 마이그레이션 파일을 삭제해야합니다. AddDeviseToAdmins라고합니다. 현재 admin 테이블에 이미있는 필드를 복제하지 않도록 편집하십시오. 필자의 경우 디폴트로 생성 된 admin 테이블은 이미 모든 것을 포함하고 있기 때문에 파일을 완전히 삭제했다.

  2. 그 첫 번째 S.O. 두 번째 옵션은 source-type => "something"과 같이 잘못 입력 된 것입니다. 그것은되어야합니다 : source_type => "무언가". 밑줄을 사용하고 대시는 사용하지 마십시오.

관련 문제