module Tsuga::Adapter::ActiveRecord::Cluster

Public Class Methods

included(by) click to toggle source
# File lib/tsuga/adapter/active_record/cluster.rb, line 8
def self.included(by)
  by.send :include, Base
  by.send :include, Tsuga::Model::Cluster
  by.send :include, Tsuga::Adapter::Shared::Cluster
  by.extend Scopes

  by.class_eval do
    belongs_to :parent, class_name: by.name
  end
end

Public Instance Methods

children_ids() click to toggle source
Calls superclass method
# File lib/tsuga/adapter/active_record/cluster.rb, line 19
def children_ids
  @_children_ids ||= begin
    stored = super
    stored ? stored.split(',').map(&:to_i) : []
  end
end
children_ids=(value) click to toggle source
Calls superclass method
# File lib/tsuga/adapter/active_record/cluster.rb, line 26
def children_ids=(value)
  changed = (@_children_ids != value)
  @_children_ids = value
  super(@_children_ids.join(',')) if changed
  @_children_ids
end