GithubHelp home page GithubHelp logo

Comments (6)

kjayma avatar kjayma commented on July 19, 2024

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:

  1. Are you using the testbed application as-is or have you customized it any way?
  2. What versions of ruby and rails are you using?
  3. Does the error message indicate which specific attribute is causing the problem?

from surveyor_gui.

taiwoayanleye avatar taiwoayanleye commented on July 19, 2024

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)"

from surveyor_gui.

kjayma avatar kjayma commented on July 19, 2024

So a couple of things - the Zurb branch of SurveyorGui is a work in
progress and definitely has bugs. The simple_form branch of Surveyor also
was broken last I checked and I don't think that's changed. I prefer
Simple Form over Formtastic, but was never able to get that branch of
Surveyor to work (though I didn't put a lot of time into it). I'd avoid
the custom branches. Pull the latest surveyor_gui master from github and
go with that. Otherwise, be prepared to do some debugging on your own.
Your welcome to fork surveyor_gui and see if you can finish up the Zurb
branch and get simple_form working with Surveyor. I'd be happy to pull it
in if you get it working :)

On Thu, Feb 5, 2015 at 7:23 AM, Taiwo Ayanleye [email protected]
wrote:

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)"


Reply to this email directly or view it on GitHub
#43 (comment).

from surveyor_gui.

EmCousin avatar EmCousin commented on July 19, 2024

In Rails 4, The error is due to the params in the update method that are not permitted.

As a workaround, I'd suggest to override the update method of the surveyor_controller.rb by generating a custom controller and define private params methods permitting the different params.

To do so:

$ rails generate surveyor:custom

Then in the update method, remove the call to super, get the method's source code and define private methods to permit the params.

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 ;)

from surveyor_gui.

lyralyra avatar lyralyra commented on July 19, 2024

Hi, I have the same error appearing when I try to preview my survey, after one section I get the Forbidden Attributes Error.
When I was using surveyor_gui 0.1.2, EmCousin's workaround worked, but now that I'm getting surveyor_gui from the master it doesn't work anymore. I am not very familiar with ruby on rails, so I have a hard time understanding what everything does.
Any idea what might be the problem?

from surveyor_gui.

kjayma avatar kjayma commented on July 19, 2024

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

from surveyor_gui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.