Reputation: 31
I'm having an issue with ActiveAdmin.
I have the following models:
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
And this active admin resource
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
When i'm on the form in the ActiveAdmin interface I see the fields for title and category properly, then on the questions section I get a button to add a question but when clicked it does nothing.
Any idea of what I'm doing wrong? Thanks!
Upvotes: 1
Views: 1123
Reputation: 1985
I've been banging my head on the wall until I saw an open issue on the active admin github
The solution is to rollback from active admin 0.5.1 to 0.5.0
Upvotes: 0
Reputation: 40277
You normally need to add your attributes to attr_accessible, so lets add
attr_accessible :category, :string, :template_questions_attributes
Upvotes: 1