Sha256: 145db96af90b38f48a0a227670cb5a7129512af699d247db7c636d2e24a66bb9

Contents?: true

Size: 540 Bytes

Versions: 5

Compression:

Stored size: 540 Bytes

Contents

class PageAttachment < ActiveRecord::Base
  belongs_to :asset
  belongs_to :page
  attr_accessor :selected

  # attr_accessible :asset, :page, :asset_id, :page_id

  accepts_nested_attributes_for :asset

  acts_as_list :scope => :page_id

  def selected?
    !!selected
  end

  # a small change to the method in acts_as_list so that we don't override
  # the position value if it has already been set (as it usually is for new attachments)
  def add_to_list_bottom
    self[position_column] ||= bottom_position_in_list.to_i + 1
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trusty-clipped-extension-3.1.4 app/models/page_attachment.rb
trusty-clipped-extension-3.1.3 app/models/page_attachment.rb
trusty-clipped-extension-3.1.2 app/models/page_attachment.rb
trusty-clipped-extension-3.1.1 app/models/page_attachment.rb
trusty-clipped-extension-3.1.0 app/models/page_attachment.rb