-1

I'm trying to add a table to my app but when I do I get the error shown below. But I don't understand why? All I did was adding the Recommendation class.

class Item
  include DataMapper::Resource
  property :id, Serial
  property :sortorder, Integer
  property :title, Text
  property :company, String
  property :desc, Text
  property :year, Integer
  property :url, String
  mount_uploader :source, ImageUploader
end

class Recommendations
  include Datamapper::Resource
  property :id, Serial
  property :firstname, String
  property :lastname, String
  property :title, String
  property :mugshot, String
  property :text, Text
end

configure :development do
    DataMapper.auto_upgrade!
    DataMapper.finalize
    puts "you're developing"
end 

The error:

15:30:27 [rerun] Joelsanden-se launched

/Users/simpel/Sites/ruby/joelsanden-se/main.rb:48:in `<class:Recommendations>': uninitialized constant Recommendations::Datamapper (NameError)
from /Users/simpel/Sites/ruby/joelsanden-se/main.rb:47:in `<top (required)>'
from /Users/simpel/Sites/ruby/joelsanden-se/config.ru:19:in `require'
from /Users/simpel/Sites/ruby/joelsanden-se/config.ru:19:in `block in <main>'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /Users/simpel/Sites/ruby/joelsanden-se/config.ru:in `new'
from /Users/simpel/Sites/ruby/joelsanden-se/config.ru:in `<main>'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:250:in `start'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:141:in `start'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/bin/rackup:4:in `<top (required)>'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/bin/rackup:23:in `load'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/bin/rackup:23:in `<main>'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/simpel/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'

15:30:29 [rerun] Joelsanden-se Launch Failed
Joel
  • 3,066
  • 5
  • 21
  • 26

1 Answers1

3

You have a typo - Datamapper should be DataMapper

so use

include DataMapper::Resource

instead of

include Datamapper::Resource