-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testbed app raising Forbidden Attributes Error #43
Comments
Strong params are a bit indirect in Surveyor and SurveyorGui. You can find them in SurveyorGui under app/models/permitted_params_decorator.rb. That file reopens the PermittedParams class which is originally defined in the Surveyor gem at app/models/permitted_params.rb. Not sure why you might be experiencing this error. Perhaps you can provide some more information:
|
First I'm using the 'simple_form' branch of Surveyor and 'zurb' branch of SurveyorGui. No error attributes was specified only the parameters from the survey submitted were returned(I don't have the screenshot anymore). I haven't customised the testbed application. Rails version is '4.1.6', Ruby is '2.2.0'. I tried using the SurveyorGui on another branch of my real app but I kept getting error with the simple_form version. I'm guessing Surveyor is locked for simple_form '3.1.0.rc' while SurveyorGui is locked for simple_form '3.0.2'. Could it be beacuse I'm not using the master branches of the gems? I 've tried it too and I got this error: "undefined method `boolean_label_class=' for SimpleForm:Module (NoMethodError)" |
So a couple of things - the Zurb branch of SurveyorGui is a work in On Thu, Feb 5, 2015 at 7:23 AM, Taiwo Ayanleye [email protected]
|
In Rails 4, The error is due to the params in the As a workaround, I'd suggest to override the To do so: $ rails generate surveyor:custom Then in the My code : # [...]
def update
#super
question_ids_for_dependencies = (r_params || []).map{|k,v| v["question_id"] }.compact.uniq
saved = load_and_update_response_set_with_retries
return redirect_with_message(surveyor_finish, :notice, t('surveyor.completed_survey')) if saved && finish_params
respond_to do |format|
format.html do
if @response_set.nil?
return redirect_with_message(surveyor.available_surveys_path, :notice, t('surveyor.unable_to_find_your_responses'))
else
flash[:notice] = t('surveyor.unable_to_update_survey') unless saved
redirect_to surveyor.edit_my_survey_path(anchor: anchor_from(section_params), section: section_id_from(params))
end
end
format.js do
if @response_set
render json: @response_set.reload.all_dependencies(question_ids_for_dependencies)
else
render text: "No response set #{response_set_code_params}",
status: 404
end
end
end
end
# [...] [And in the custom controller : ]
private
def r_params
return unless params[:r]
params.require(:r).permit!
end
def section_params
return unless params[:section]
params.require(:section).permit!
end
def finish_params
return unless params[:finish]
params.require(:finish)
end
def response_set_code_params
return unless params[:response_set_code]
params.require(:response_set_code).permit!
end
# [...] PS : sorry for my English. And feel free to propose improvements to this workaround, because I'm not sure I've found the optimal solution yet ;) |
Hi, I have the same error appearing when I try to preview my survey, after one section I get the Forbidden Attributes Error. |
Hey guys, I'll take another look, but would one of you be able to specify a test case that I can try off the master branch? What conditions are creating this error? Thanks |
I am trying out surveyor-gui before incorporating it into an application, and after the basic question survey was completed, attempting to go to the next section raised:
ActiveModel::ForbiddenAttributesError in SurveyorController#update
I was wondering if this was a strongparams work and couldn't find strongparams defined in the SurveyorController. I also attempted to set the strongparams, but I have no idea of the attributes defiend in the model. Which way?
The text was updated successfully, but these errors were encountered: