Sha256: e129680ab578b9899447b55fb2d385a419b2ee1d4649adc6a8dc1c41bdbd2b1d
Contents?: true
Size: 515 Bytes
Versions: 3
Compression:
Stored size: 515 Bytes
Contents
# encoding: utf-8 module DynamicImage # = DynamicImage Belongs To # module BelongsTo extend ActiveSupport::Concern module ClassMethods def belongs_to_image(name, scope = nil, **options) belongs_to(name, scope, options) define_method "#{name}=" do |new_image| if new_image.present? && !new_image.is_a?(DynamicImage::Model) new_image = send("build_#{name}", file: new_image) end super(new_image) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dynamic_image-2.0.16 | lib/dynamic_image/belongs_to.rb |
dynamic_image-2.0.15 | lib/dynamic_image/belongs_to.rb |
dynamic_image-2.0.14 | lib/dynamic_image/belongs_to.rb |