2012-07-12 2 views
1

ActiveAdmin에 문제가 있습니다. ActiveAdmin 양식 문제 (has_many)

나는이 다음 모델 :

template.rb

class Template < ActiveRecord::Base 
    belongs_to :category 
    has_many :template_questions 
    has_many :questionnaires 
    attr_accessible :category, :string 
    accepts_nested_attributes_for :template_questions 
end 

template_question.rb

class TemplateQuestion < ActiveRecord::Base 
    belongs_to :template 
    attr_accessible :number, :question 
end 

그리고이 활성 관리자 자원 내가 해요

ActiveAdmin.register Template do 
    form do |f| 
    f.inputs "Details" do 
     f.input :title 
     f.input :category 
    end 
    f.inputs "Questions" do 
     f.has_many :template_questions do |j| 
     j.input :question 
     end 
    end 
    f.buttons 
    end 
end 

...에 ActiveAdmin 인터페이스의 양식 제목과 카테고리에 대한 필드가 올바르게 표시됩니다. 그런 다음 질문 섹션에 질문을 추가하는 버튼이 있지만 클릭 할 때 아무 것도하지 않습니다.

내가 잘못하고있는 것에 대한 아이디어가 있습니까? 감사!

답변

1

정상적으로 그래서 활성 관리자 GitHub의

솔루션상의 open issue을 볼 때까지 나는 벽에 머리를 두드리는 있었어요

attr_accessible :category, :string, :template_questions_attributes 
+0

이것은 내 주요 문제가 아니며, 자바 스크립트로 밝혀졌습니다. 하지만 덕분에이 일이 정말 나중에 도움이되었습니다. –

+2

동일한 문제가 있습니다. "javascript가있는 것"이 ​​무엇인지 알려주실 수 있습니까? – jeem

0

추가 할 수 있습니다, 당신의 속성이 attr_accessible에 추가 할 필요가 활성 관리자 0.5.1에서 0.5.0으로 롤백하는 것입니다.

관련 문제