Module: Rose::ActiveRecordExtensions::ClassMethods

Defined in:
lib/rose/active_record.rb

Instance Method Summary collapse

Instance Method Details

#root_for(name, options = {}, *args) ⇒ Object



34
35
36
# File 'lib/rose/active_record.rb', line 34

def root_for(name, options={}, *args)
  seedlings(name).photosynthesize(self.find(:all, *args), options)
end

#rose(name, options = {}, &blk) ⇒ Object



24
25
26
27
28
# File 'lib/rose/active_record.rb', line 24

def rose(name, options={}, &blk)
  instance = Rose::Seedling.new(Rose::ActiveRecordAdapter, options.merge(:class => self))
  instance.instance_eval(&blk)
  register_seedling(name, instance)
end

#rose_for(name, *args) ⇒ Object



30
31
32
# File 'lib/rose/active_record.rb', line 30

def rose_for(name, *args)
  seedlings(name).bloom(self.find(:all, *args))
end

#seedlings(name) ⇒ Object



38
39
40
41
# File 'lib/rose/active_record.rb', line 38

def seedlings(name)
  @seedlings ||= {}
  @seedlings[name]
end