Created
April 5, 2011 17:53
-
-
Save Alir3z4/904119 to your computer and use it in GitHub Desktop.
You cannot call create unless the parent is saved
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
remembering those days in rails.
Django Rocks!