I am trying to use composed_of in my model, but I not succeeding.
With the code I pasted below, I cannot perform this action in the
property = Property.new(1, “px”)
I get NameError: uninitialized constant Property when I try to perform
that action. It’s not finding my class I made I suppose. The Property
class is in the same file as the Element class, element.rb.
Does anyone know how to do this?
Thanx for any and all info.
My model is simple:
class Element < ActiveRecord::Base
:class_name => “Property”,
My class for this is simple:
attr_reader :amount, :unit
def intialize(amount, unit)
@amount = amount
@unit = unit
@amount.to_s + @unit