Sha256: bcedc4ed0981a4f26cad92ea70f40109742aaecef9a24b7fea81b62bd097dfca

Contents?: true

Size: 409 Bytes

Versions: 1

Compression:

Stored size: 409 Bytes

Contents

class Cms::Tab < ActiveRecord::Base
  ComfyPress.establish_connection(self)

  self.table_name = 'cms_tabs'

  attr_accessible :label, :content, :site_id, :page_id, :is_active, :position

  belongs_to :page

  before_create :assign_position

  default_scope order('cms_tabs.position')

protected
  def assign_position
    max = self.page.tabs.maximum(:position)
    self.position = max ? max + 1 : 0
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
comfypress-0.1.4 app/models/cms/tab.rb