Adapters not working with datamapper
Uninstalling dm-postgres-adapter 1.2.0.rc2 fixed it.
Heroku and Datamapper problems
"The thing about this is that I'm not using postgres, so I'm confused why it is saying this."
You're using Heroku, so you are using Postgresql.
In your app.rb
you have this line:
DataMapper::setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/notes.db")
which I'm guessing you got from the Heroku database docs. This line basically says "check for the environment variable 'DATABASE_URL', and if it's set use it as the database url, otherwise use the Sqlite url". Running locally this environment variable won't be set, so you'll use the Sqlite url, but on Heroku this will be set to something like (see the page linked above):
postgres://username:password@hostname/database
Datamapper will see that this is a Postgresql url, and try to require the postgres adapter, which isn't installed so will result in the error that you see.
The best solution would be to install Postgresql locally, so that your development and production environments are as similar as possible. If you can't do this, or don't want to, you can specify the Sqlite adapter locally, and the Postgres adapter in production. It'll look something like this in your Gemfile:
group :development do
gem 'dm-sqlite-adapter'
end
group :production do
gem 'dm-postgres-adapter'
end
If you do this you'll need to tell Heroku to which groups to leave out when installing gems, see the Heroku Gem Bunder docs.
LoadError: no such file to load -- dm-sqlite-adapter
I don't see the dm-sqlite-adapter gem in that list. Try installing it.
ruby datamapper will not load
You need to require 'data_mapper'
, not datamapper
.
Note there is a datamapper
gem as well as a data_mapper
gem, but they are the same thing, just different names. You need use data_mapper
as the library name in both of them.
As far as I can tell datamapper
is a straight copy of data_mapper
:
$ diff -r data_mapper-1.2.0/ datamapper-1.2.0/
diff -r data_mapper-1.2.0/Rakefile datamapper-1.2.0/Rakefile
21c21
< GEM_NAME = 'data_mapper'
---
> GEM_NAME = 'datamapper'
Ruby Problem with DataMapper DataObjects::URI.new with arguments is deprecated...
It's fixed in github in this commit https://github.com/snaggled/dm-do-adapter/commit/d674255fae9ba6e9269290626cf97579d3b7a88d
You can aither apply it manually in your the patch to C:/Ruby192/lib/ruby/gems/1.9.1/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb
- or (not sure if this can work on Windows) -
gem install bundler
git clone git://github.com/snaggled/dm-do-adapter.git
cd dm-do-adapter
Edit Gemfile and replace 'http://' with 'git://'
bundle
rake build
gem install pkg/dm-do-adapter-1.1.1.gem
Related Topics
Getting a Rogue Iteration from My .Each Loop
Instance_Eval Does Not Work with Do/End Block, Only with {}-Blocks
Open Xml File with Nokogiri Update Node and Save
How to Transform the Utf8 Chars to Iso8859-1
Ruby Parenthesis Syntax Exception with I++ ++I
Using Poltergeist with a Proxy
How to 'Join' an Array Adding to the Beginning of the Resulting String the First Character to Join
Ruby Facebook Graph API Appsecret_Proof
How to Understand the #Dup and #Clone Operate on Objects Which Referencing Other Objects
Rails 404 Error for Stylesheet or JavaScript Files
Calling Instance Variables Without @
Stubbing Controller Actions in Rspec Request Specs
How to Sort So That "Vitamin B12" Is Not in Front of "Vitamin B6"
Undefined Method Error When Creating Delayed_Job Workers with Script/Delay_Job
Can Nokogiri Use Single Quotes for Attributes on Saving Xml
Gem Install Wrong Number of Arguments (Given 4, Expected 1)