Dave Burt
2/12/2005 1:05:00 PM
Hi,
Can any Rails gurus help me out with this? I'm using Rails 0.9.5, and have a
model like so:
class Person < ActiveRecord::Base
composed_of :family,
:mapping => [%w(family_name name), %w(family_phone phone),
%w(family_address address)]
end
But I don't get Person#family_name et. al.:
NoMethodError in Person#index
Showing /person/list.rhtml where line #18 raised "undefined method
`family_name' for #<Person:0x2b27e28>"
The doco on ActiveRecord::Aggregations::ClassMethods says:
(begin quote)
Example:
class Customer < ActiveRecord::Base
composed_of :balance, :class_name => "Money", :mapping => %w(balance
amount)
composed_of :address, :mapping => [ %w(address_street street),
%w(address_city city) ]
end
The customer class now has the following methods to manipulate the value
objects:
Customer#balance, Customer#balance=(money)
Customer#address, Customer#address=(address)
(end quote)
If it's not working as documented, is there a simple alternative?
Thanks for any help,
Dave