When creating a new entry for my "question" object, my code works fine.
However, using various methods, I can't get the edit route to submit to def update correctly.
After a lot of head-scratching, I realized my create method performs a split on a named object like this:
def create
@question = Question.new(params[:question])
...
@question.options = @question.options.split(',').collect(&:strip)
In my update method,
def update
@question = Question.find(params[:id])
I need to somehow format the options of params[:question] in this line:
if @question.update_attributes(params[:question])
Otherwise, update_attributes fails. I cannot figure out how to do this. Any help appreciated.
Output of @question.options after formatting with split:
["options", "---\n- Extremely unlikely\n- Unlikely\n- Neutral\n- Likely\n- Extremely likely\n-"]
@question.options.