Sha256: 39046e7a5e58314db225f66ff83271709896efae7adba9c49ebe148b0cec977e

Contents?: true

Size: 484 Bytes

Versions: 40

Compression:

Stored size: 484 Bytes

Contents

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

  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

40 entries across 40 versions & 1 rubygems

Version Path
trusty-cms-3.7.0 app/models/page_attachment.rb
trusty-cms-3.6.2 app/models/page_attachment.rb
trusty-cms-3.6.1 app/models/page_attachment.rb
trusty-cms-3.6.0 app/models/page_attachment.rb
trusty-cms-3.5.5 app/models/page_attachment.rb
trusty-cms-3.5.4 app/models/page_attachment.rb
trusty-cms-3.5.3 app/models/page_attachment.rb
trusty-cms-3.5.2 app/models/page_attachment.rb
trusty-cms-3.5.1 app/models/page_attachment.rb
trusty-cms-3.5.0 app/models/page_attachment.rb
trusty-cms-3.4.0 app/models/page_attachment.rb
trusty-cms-3.3.7 app/models/page_attachment.rb
trusty-cms-3.3.6 app/models/page_attachment.rb
trusty-cms-3.3.5 app/models/page_attachment.rb
trusty-cms-3.3.3 app/models/page_attachment.rb
trusty-cms-3.3.2 app/models/page_attachment.rb
trusty-cms-3.3.1 app/models/page_attachment.rb
trusty-cms-3.2.1 app/models/page_attachment.rb
trusty-cms-3.3.0 app/models/page_attachment.rb
trusty-cms-3.2.0 app/models/page_attachment.rb