Sha256: 7d11fa56c9300515752b3e897175a11bf7c9bc44aa6b1a6cab40c67c51925eb2

Contents?: true

Size: 562 Bytes

Versions: 3

Compression:

Stored size: 562 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
    p "add_to_list_bottom: current value is #{self[position_column]}"
    self[position_column] ||= bottom_position_in_list.to_i + 1
  end
  
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
radiant-clipped-extension-1.0.1 app/models/page_attachment.rb
radiant-clipped-extension-1.0.0 app/models/page_attachment.rb
radiant-1.0.0.rc2 vendor/extensions/clipped/app/models/page_attachment.rb