Skip to content

Instantly share code, notes, and snippets.

@makoto
Created November 12, 2008 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makoto/24147 to your computer and use it in GitHub Desktop.
Save makoto/24147 to your computer and use it in GitHub Desktop.
def after_create
- self.uploaded_photo_ids.each{|photo| self.photos << Photo.find(photo)} unless self.uploaded_photo_ids.blank?
+ self.photos << Photo.find_all_by_id(self.uploaded_photo_ids.compact) unless self.uploaded_photo_ids.blank?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment