Commit 3972a61868282f2f56490c8a388908bb7fda2b60
1 parent
16252ded
Exists in
master
and in
1 other branch
hotfix for error where seed ideas would be broken up into words, rather than lines
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
app/controllers/questions_controller.rb
| ... | ... | @@ -15,7 +15,7 @@ class QuestionsController < InheritedResources::Base |
| 15 | 15 | def create |
| 16 | 16 | authenticate |
| 17 | 17 | logger.info "vi is #{params['question']['visitor_identifier']} and local are #{params['question']['local_identifier']}. all params are #{params.inspect}" |
| 18 | - if @question = current_user.create_question(params['question']['visitor_identifier'], :name => params['question']['name'], :local_identifier => params['question']['local_identifier'], :ideas => params['question']['ideas'].split) | |
| 18 | + if @question = current_user.create_question(params['question']['visitor_identifier'], :name => params['question']['name'], :local_identifier => params['question']['local_identifier'], :ideas => params['question']['ideas'].lines.to_a) | |
| 19 | 19 | respond_to do |format| |
| 20 | 20 | format.xml { render :xml => @question.to_xml} |
| 21 | 21 | end | ... | ... |
app/models/question.rb
| ... | ... | @@ -67,7 +67,7 @@ class Question < ActiveRecord::Base |
| 67 | 67 | validates_presence_of :creator, :on => :create, :message => "can't be blank" |
| 68 | 68 | |
| 69 | 69 | def ensure_at_least_two_choices |
| 70 | - the_ideas = (self.ideas.blank? || self.ideas.empty?) ? ['sample idea 1', 'sample idea 2'] : self.ideas.lines | |
| 70 | + the_ideas = (self.ideas.blank? || self.ideas.empty?) ? ['sample idea 1', 'sample idea 2'] : self.ideas | |
| 71 | 71 | if self.choices.empty? |
| 72 | 72 | the_ideas.each { |choice_text| |
| 73 | 73 | item = Item.create!({:data => choice_text, :creator => creator}) | ... | ... |