Module: Busket::Helper::InstanceMethods

Defined in:
lib/busket/helper.rb

Instance Method Summary collapse

Instance Method Details

#bucketsObject



44
45
46
# File 'lib/busket/helper.rb', line 44

def buckets
  self.class.buckets
end

#collection_exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/busket/helper.rb', line 37

def collection_exists? name
  !!collection_with_name(name).find_one(:linked_id => self.send(self.buckets[name][:identifier]), :linked_type => self.class.to_s)
end

#collection_with_name(name) ⇒ Object



41
42
43
# File 'lib/busket/helper.rb', line 41

def collection_with_name name
  self.send("#{name}_collection".to_sym)
end