Ocean Moon
Ocean Moon

Reputation: 77

I get same error with my DataMapper models no matter how i'm building them

Whatever columns/types/relations i'm using within my DataMapper models i'm always get same fatal error:

undefined method `include?' for nil:NilClass

a sample model:

class Book
  include DataMapper::Resource

  property :id, Serial
  property :name, String
end

Even with this trivial model i get that weird error.

Latest datamapper, reinstalled to be sure it is no broken somehow. Ruby 1.9.3 Mysql 5

Sequel works just well on same environment.

Upvotes: 3

Views: 65

Answers (1)

user904990
user904990

Reputation:

did you call DataMapper.finalize after defining your models?

try:

class Book
  include DataMapper::Resource

  property :id, Serial
  property :name, String
end

DataMapper.finalize # this is required on any scenario

Official docs: http://datamapper.org/getting-started.html

See Finalize Models at the bottom

Upvotes: 3

Related Questions