Skip to content

Instantly share code, notes, and snippets.

@matschaffer
Created January 17, 2013 20:53
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 matschaffer/4559658 to your computer and use it in GitHub Desktop.
Save matschaffer/4559658 to your computer and use it in GitHub Desktop.
####
belongs_to :attachable, :polymorphic => true
####
has_many :images, :as => :attachable, :dependent => :destroy
accepts_nested_attributes_for :images, :reject_if => lambda { |a|
a[:file].blank? && a[:file_uid].blank? && a[:file_url].blank? && a[:name].blank?
}, :allow_destroy => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment