Class: Marty::VwPromise

Inherits:
Base show all
Defined in:
app/models/marty/vw_promise.rb

Defined Under Namespace

Classes: VirtualRoot

Constant Summary

Constants inherited from ActiveRecord::Base

ActiveRecord::Base::COUNT_SIG, ActiveRecord::Base::DISTINCT_SIG, ActiveRecord::Base::FIND_BY_SIG, ActiveRecord::Base::FIRST_SIG, ActiveRecord::Base::GROUP_SIG, ActiveRecord::Base::JOINS_SIG, ActiveRecord::Base::LAST_SIG, ActiveRecord::Base::LIMIT_SIG, ActiveRecord::Base::MCFLY_PT_SIG, ActiveRecord::Base::NOT_SIG, ActiveRecord::Base::ORDER_SIG, ActiveRecord::Base::PLUCK_SIG, ActiveRecord::Base::SELECT_SIG, ActiveRecord::Base::WHERE_SIG

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

get_final_attrs, get_struct_attrs, make_hash, make_openstruct, mcfly_pt

Methods inherited from ActiveRecord::Base

joins, old_joins

Class Method Details

.children_for_id(id, search_order) ⇒ Object



42
43
44
45
# File 'app/models/marty/vw_promise.rb', line 42

def self.children_for_id(id, search_order)
  q = id == 'root' ? where(parent_id: nil) : find(id).children
  q.live_search(search_order).order(id: :desc).includes(:children, :user)
end

.rootObject



38
39
40
# File 'app/models/marty/vw_promise.rb', line 38

def self.root
  VirtualRoot.new
end

Instance Method Details

#leafObject



47
48
49
# File 'app/models/marty/vw_promise.rb', line 47

def leaf
  children.empty?
end

#to_sObject



51
52
53
# File 'app/models/marty/vw_promise.rb', line 51

def to_s
  inspect
end