Sha256: d297e241d7511c4f846d677df1854cd9315a77b20992ac229a2119e0aaf49dea

Contents?: true

Size: 546 Bytes

Versions: 15

Compression:

Stored size: 546 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

15 entries across 15 versions & 1 rubygems

Version Path
trusty-clipped-extension-3.0.0 app/models/page_attachment.rb
trusty-clipped-extension-2.0.15 app/models/page_attachment.rb
trusty-clipped-extension-2.0.14 app/models/page_attachment.rb
trusty-clipped-extension-2.0.13 app/models/page_attachment.rb
trusty-clipped-extension-2.0.12 app/models/page_attachment.rb
trusty-clipped-extension-2.0.11 app/models/page_attachment.rb
trusty-clipped-extension-2.0.10 app/models/page_attachment.rb
trusty-clipped-extension-2.0.9 app/models/page_attachment.rb
trusty-clipped-extension-2.0.8 app/models/page_attachment.rb
trusty-clipped-extension-2.0.7 app/models/page_attachment.rb
trusty-clipped-extension-2.0.6 app/models/page_attachment.rb
trusty-clipped-extension-2.0.5 app/models/page_attachment.rb
trusty-clipped-extension-2.0.4 app/models/page_attachment.rb
trusty-clipped-extension-2.0.3.pre.beta app/models/page_attachment.rb
trusty-clipped-extension-2.0.2.pre.beta app/models/page_attachment.rb