Active Admin에서 3 번째 날입니다.활성 관리자에서 심하게 중첩 할 수 있습니까?
저는 @survey
이 has_many :questions
이고 각 질문은 has_many :answers
입니다. 이들은 실제로 사용자가 선택할 수있는 변형입니다.
하지만 아직 작동하지 않습니다. 단지 1 레벨 이하의 아무 것도 만들지 않습니다. 양식도 제대로 작동하지만 아무 것도 만들어지지 않습니다.
Active Admin에서 3 번째 날입니다.활성 관리자에서 심하게 중첩 할 수 있습니까?
저는 @survey
이 has_many :questions
이고 각 질문은 has_many :answers
입니다. 이들은 실제로 사용자가 선택할 수있는 변형입니다.
하지만 아직 작동하지 않습니다. 단지 1 레벨 이하의 아무 것도 만들지 않습니다. 양식도 제대로 작동하지만 아무 것도 만들어지지 않습니다.
다음 코스가 있습니다. 코스 -> 섹션 -> 수업.
form do |f|
f.inputs "Details" do
f.input :instructor, :as => :select
f.input :title
f.input :name
f.input :price
f.input :discount
f.input :slug
f.inputs "Sections" do
f.has_many :sections, :header=>"" do |section|
section.input :name
section.input :position
if section.object.id
section.input :_destroy, :as=>:boolean, :required => false, :label=>'Remove'
end
section.has_many :lessons, :header=>"Lessons" do |lesson|
lesson.input :title
lesson.input :position
lesson.input :duration
lesson.input :_destroy, :as=>:boolean, :required => false, :label=>'Remove'
end
end
end
end
f.buttons
end
내 모델은 다음과 같습니다 :
class Course < ActiveRecord::Base
has_many :sections, :dependent => :delete_all
accepts_nested_attributes_for :sections, :allow_destroy => true
attr_accessible :sections_attributes
....
class Section < ActiveRecord::Base
belongs_to :course
has_many :lessons, :dependent => :delete_all
attr_accessible :course_id, :name, :position
accepts_nested_attributes_for :lessons, :allow_destroy => true
attr_accessible :lessons_attributes
....
class Lesson < ActiveRecord::Base
belongs_to :section
attr_accessible :duration, :position, :section_id, :title
....
그리고 그것은 잘 작동
나는 다음과 같은했다! 좀 더 깊이 들어가면 어떻게 될지 모르겠다.
니스! 나는 이미 그것을 해결했다. 그러나 이것이 다른 누군가를 돕기를 바랍니다 !!! – prikha
@tony 우리가 HABTM 연결을 사용한다면 ??? 우리가해야 할 일? –
레일 4에 대한 모든 업데이트가 필요합니까? 이제 보호 속성이 컨트롤러에 설정되어있는 것 같습니다. 우리는'permit_params'를 사용해야합니까? – Defoncesko
모델에 코드를 붙여 넣으면 활성 관리 자원 구현 – JCorcuera
이 ActiveAdmin 문제에서 주석을 확인하십시오. 그리고 "중첩 된"것을 포함하는 다른 이슈들. https://github.com/gregbell/active_admin/issues/478 그리고 여기도보십시오 : http://stackoverflow.com/questions/8224884/nested-form-in-active-admin – slothbear
내 질문 *)))))) – prikha