Hi,

I have two models that share some of the same attributes so I wanted to 
setup a single table inheritance structure.  After doing some research, I 
found out that I can use module to achieve the same by doing the following 
instead:

module CommonFields
  def self.included base
    base.class_eval do
      include DataMapper::Resource

      property :type, base::Discriminator
      property :enable_feature1, base::Boolean, :default => false
      property :enable_feature2, base::Boolean, :default => false
    end
  end
end

class A
      include CommonFields

      property: title, String
end

class B
      include CommonFields
end

However, when I do rake db:automigrate I get:

undefined method `properties' for CommonFields:Module
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/dm-core-1.2.0/lib/dm-core/associations/relationship.rb:252:in
 
`parent_key'

Any ideas?

Thanks,

Paul

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to datamapper+unsubscr...@googlegroups.com.
To post to this group, send email to datamapper@googlegroups.com.
Visit this group at http://groups.google.com/group/datamapper?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to