Sha256: 3867ea6bfaf98fd2287814b4b87287c9eb34eadc6fda37f20075ecc008c9f32c
Contents?: true
Size: 321 Bytes
Versions: 2
Compression:
Stored size: 321 Bytes
Contents
module WithPhoto extend ActiveSupport::Concern included do attr_accessor :tokens has_many :photos, dependent: :destroy, as: :imageable after_create :assign_photos end def assign_photos Photo.where(token: tokens || []).update_all(imageable_id: self.id, imageable_type: self.class.name) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redde-0.1.10 | lib/redde/concerns/with_photo.rb |
redde-0.1.9 | lib/redde/with_photo.rb |