caring / composition_generator

Generate ActiveRecord Aggregations and convenience methods for composing them into your models.

This URL has Read+Write access

composition_generator / README
100644 27 lines (16 sloc) 0.495 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
CompositionGenerator
====================
 
Generates a composition model and a convenience method for mixing it into your models.
 
Example
=======
 
./script/generate composition address street city state zip_code
 
class Person < ActiveRecord::Base
  has_address
end
 
p = Person.new
 
p.address = Address.new('1234 S. Main St.', 'Anytown', 'CA', 91234)
 
 
p.address.street
# => "1234 S. Main St."
 
p.street
# => "1234 S. Main St."
 
Copyright (c) 2008 Chris Eppstein, released under the MIT license