Active Admin을 사용하는 레일 앱이 있습니다. 기본 흐름은 인시던트 모델에 다른 모델과의 연관성이 있다는 것입니다. 다른 모델과의 연결은 괜찮은 것처럼 보이지만 한 모델 (관련)에서는 특히 새로운 인시던트를 만들 때 초기화되지 않은 상수 인 인시던트 :: Involf가 오류가 발생합니다.초기화되지 않은 상수 [Incident :: Involf]
사고 모델은 모델은 중첩 된 사건에 대한 적극적인 관리 모델은 특별 고려 사항이 작동이
f.inputs "Vehicles Involved" do
f.input :involves, :as => :check_boxes
end
f.inputs "Special Considerations" do
f.input :special_considerations, :as => :check_boxes
end
모습이
class Involve < ActiveRecord::Base
# Relationships
has_and_belongs_to_many :incidents
# Aliases
alias_attribute :name, :involved
end
처럼 보인다 참여이
class Incident < ActiveRecord::Base
# Relationships
belongs_to :admin_user
has_many :images
has_and_belongs_to_many :incident_types
has_and_belongs_to_many :involves
has_and_belongs_to_many :special_considerations
belongs_to :county
belongs_to :location
# Nested Attributes
accepts_nested_attributes_for :images
accepts_nested_attributes_for :county
accepts_nested_attributes_for :location
accepts_nested_attributes_for :incident_types
accepts_nested_attributes_for :involves
accepts_nested_attributes_for :special_considerations
end
처럼 보인다 내가 f.input을 가지고 있다면 :, : => : check_boxes가 댓글을 달았습니다. 나가 그것을 주석으로 처리하지 않으면이 오류가 발생합니다.
데이터베이스와 연관을 살펴본 결과 코드가 다른 것과 매우 유사하여 어떤 문제인지 잘 모릅니다.