Skip to content

Instantly share code, notes, and snippets.

@Alir3z4
Created April 5, 2011 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Alir3z4/904119 to your computer and use it in GitHub Desktop.
Save Alir3z4/904119 to your computer and use it in GitHub Desktop.
You cannot call create unless the parent is saved
# OLD One with error => 'You cannot call create unless the parent is saved'
def number_list=(numbers_string)
self.numbers.destroy_all
numbers = numbers_string.split(",").collect{|num| num.strip.downcase}.uniq
numbers.each do |number|
num = self.numbers.find_or_create_by_content(number)
end
end
@Alir3z4
Copy link
Author

Alir3z4 commented Jan 7, 2013

remembering those days in rails.
Django Rocks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment