codemancers / rapidfire

Making dynamic surveys should be easy!
https://rapidfire.fly.dev/
MIT License
319 stars 141 forks source link

fix(checkbox-answers):match answer_text to ActionController::Parameters #144

Closed snkshukla closed 4 years ago

snkshukla commented 5 years ago

From rails 4, the parameters are not just pure hashes, they are represented with ActionController::Parameters type(strong params). In the attempts controller we are still comparing the answer_text with Hash, so change that to ActionController::Parameters with this.

Since the minimum supported rails version is 4.2, we don't need to test for pure Hash as it will always be ActionController::Parameters in the versions later than 4.

Also, In rails 5, belongs_to adds the required validation by default with it. Make it optional so that non-logged in users can also take the survey.

Fixes #114 Also Fixes #145