Skip to content

answers_delimiter = "\r\n" #137

@john-huang-121

Description

@john-huang-121

Hello!

I am a somewhat new rails programmer and just found your gem. Since the gem surveyor does not work for me and is way too old, I decided to play around with it.
While playing around with checkboxes, I ran into this problem.

Answer text is invalid (when the no checkbox in a yes/no question is checked and saved)

I narrowed it down to answer_text: "{"0"=>"0", "1"=>"no"}" and the issue being answers_delimiter not breaking up the submission correctly. When I changed "\r\n" to """ in the checkbox.rb model inside validate_answer it still doesn't work.

      def validate_answer(answer)
        super(answer)
        
        if rules[:presence] == "1" || answer.answer_text.present?
          answer.answer_text.split("\"").each do |value|
            answer.errors.add(:answer_text, :invalid) unless options.include?(value)
          end
        end
      end

Is there a way to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions