Sha256: 0f2d3c056b6eeada65144c480e1501b5815a52f8253fec85e0c42cd23a130fd8

Contents?: true

Size: 486 Bytes

Versions: 10

Compression:

Stored size: 486 Bytes

Contents

require 'active_support/concern'

module Spina
  module ImageCollectable
    extend ActiveSupport::Concern

    included do
      attr_reader :image_tokens, :image_positions
    end

    def image_tokens=(ids)
      self.image_ids = ids.split(",")
    end

    def image_positions=(positions)
      positions = positions.split(",")
      self.image_collections_images.each do |image|
        image.position = positions.index(image.image.try(:id).try(:to_s))
      end
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spina-1.2.0 app/models/concerns/spina/image_collectable.rb
spina-1.1.4 app/models/concerns/spina/image_collectable.rb
spina-1.1.3 app/models/concerns/spina/image_collectable.rb
spina-1.1.2 app/models/concerns/spina/image_collectable.rb
spina-1.1.1 app/models/concerns/spina/image_collectable.rb
spina-1.1.0 app/models/concerns/spina/image_collectable.rb
spina-1.0.3 app/models/concerns/spina/image_collectable.rb
spina-1.0.2 app/models/concerns/spina/image_collectable.rb
spina-1.0.1 app/models/concerns/spina/image_collectable.rb
spina-1.0.0 app/models/concerns/spina/image_collectable.rb