You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update the active admin file (notice the comments in the code).
here is my example:
ActiveAdmin.register Survey::Survey do
permit_params :name, :attempts_number, :description, :finished, :active #mandatory for rails 4 and newer versions of active admin
menu :label => I18n.t("surveys")
filter :name,
:as => :select,
:collection => proc {
Survey::Survey.select("distinct(name)").collect { |c|
[c.name, c.name]
}
}
filter :active #,
#:as => :select,
#:collection => ["true", "false"]
# no needed activeadmin detects a boolean as yes or not automatically
filter :created_at
index do
column :name
column :description
column :active
column :attempts_number
column :finished
column :created_at
actions #default_actions
end
form do |f|
f.inputs I18n.t("survey_details") do
f.input :name
f.input :description
f.input :active #, :as => :select, :collection => ["true", "false"] no needed activeadmin detects a boolean input as checkbox
f.input :attempts_number
end
f.inputs I18n.t("questions") do
f.has_many :questions do |q|
q.input :text
q.has_many :options do |a|
a.input :text
a.input :correct
end
end
end
f.actions #buttons
end
end
There is another thing, the questions are not saving correctly, you can create a survey but when you save it, the questions were not saved, or when you try to save the survey a validation says " Survey without questions cannot be activated" in the active field and the questions that you've made, disappeared
I'm using active admin 1.0.0 pre 4
Rails 4.2.6
Ruby 2.20
the gsurvey gem "survey", "~> 0.1"
The text was updated successfully, but these errors were encountered:
i've solved it by adding this in the paramaters: permit_params :name, :description, :active, :attempts_number, :questions_attributes => [:survey_id, :text], :options_attributes => [:question_id, :weight, :text, :correct]
please consider my solution for rails 4 support and activeadmin newer versions.
Update the active admin file (notice the comments in the code).
here is my example:
There is another thing, the questions are not saving correctly, you can create a survey but when you save it, the questions were not saved, or when you try to save the survey a validation says " Survey without questions cannot be activated" in the active field and the questions that you've made, disappeared
I'm using active admin 1.0.0 pre 4
Rails 4.2.6
Ruby 2.20
the gsurvey gem "survey", "~> 0.1"
The text was updated successfully, but these errors were encountered: