Forum: Ruby on Rails Rails 3 DataMapper dm-rails sqlite3 issue

Posted by Juan Matias (jmrepetti)
on 2010-10-04 23:23
I've tried to take a look to DataMapper with Rails 3, so I follow this
simple instruction on http://github.com/datamapper/dm-rails.

$ rails new testing_dm3 -m http://datamapper.org/templates/rails.rb
$ cd testing_dm3
$ bundle install
$ rails g scaffold Person name:string
$ rake db:setup
/Users/jm/.rvm/gems/ruby-head@rails3dm/gems/rake-0.8.7/lib/rake/alt_system.rb:32:
Use RbConfig instead of obsolete and deprecated Config.
(in /Users/jm/dev/personal/testing_dm3)
[datamapper] Created database 'testing_dm3_development.db'
[datamapper] Created database 'testing_dm3_test.db'
[datamapper] Finished auto_migrate! for :default repository
'testing_dm3_development.db'

$ thin start (I like thin)

Go to http://0.0.0.0:3000/people and you should see

DataObjects::SyntaxError in People#index
no such table: people

If you don't, you are lucky. I fixed this modifying database.yml:

change "database" to "path"
   database: testing_dm3_development.db
to
    path: ./db/testing_dm3_development.db

and run:

$ rake db:setup (again)

That fixed it for me. That happend because the database is in_memory and
doesn't create the files, if you run the migration on a rails console,
inside the console you can CRUD your objects, but  when you left the
session you lost the data.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.