Commit 629c4b026b0f944aee56ab7b08a43ecea98f8aab

Authored by Dhruv Kapadia
1 parent 06f982a9

Fixing edge case to make tests pass

Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
app/models/question.rb
... ... @@ -24,7 +24,7 @@ class Question < ActiveRecord::Base
24 24 attr_accessor :ideas
25 25 after_create :create_choices_from_ideas
26 26 def create_choices_from_ideas
27   - if ideas.any?
  27 + if ideas && ideas.any?
28 28 ideas.each do |idea|
29 29 item = Item.create!(:data => idea.squish.strip, :creator => self.creator)
30 30 choices.create!(:item => item, :creator => self.creator, :active => true, :data => idea.squish.strip)
... ...