
rake db:automigrate goes wrong with numerical passwords
Reported by Ftfarias | October 20th, 2010 @ 07:04 PM
I got an error trying to run rake db:automigrate
~/Development/simplex ruby-1.9.2 (master) $ rake --trace
db:automigrate (in /home/ftfarias/Development/simplex)
Invoke db:automigrate (first_time) Invoke
environment (first_time) Execute environment
Execute db:automigrate rake aborted!
can't convert Fixnum into String
/home/ftfarias/.rvm/gems/ruby-1.9.2-p0/gems/data_objects-0.10.2/lib/data_objects/connection.rb:76:in
initialize'
/home/ftfarias/.rvm/gems/ruby-1.9.2-p0/gems/data_objects-0.10.2/lib/data_objects/connection.rb:76:in
new'
/home/ftfarias/.rvm/gems/ruby-1.9.2-p0/gems/data_objects-0.10.2/lib/data_objects/pooling.rb:177:in
block in new'
<internal:prelude>:10:in
synchronize'
.....
My Database.yml was
defaults: &defaults
adapter: postgres encoding: utf8 template: template0 host:
127.0.0.1 port: 5432
development:
database: simplex_development username: simplex password: 12345
<<: *defaults
I fixed the error changing the password from numeric to string:
development:
database: simplex_development username: simplex password: simplex
<<: *defaults
and tried again:
$ rake --trace db:automigrate (in /home/ftfarias/Development/simplex) Invoke db:automigrate (first_time) Invoke environment (first_time) Execute environment Execute db:automigrate [datamapper] Finished auto_migrate! for :default repository 'simplex_development'
all done right !
Anyway, I love datamapper ! It's great ! 1000 times better than ActiveRecord ! Thank you very guys !
Felipe
Comments and changes to this ticket
-
Martin Gamsjaeger (snusnu) October 23rd, 2010 @ 08:09 AM
- State changed from new to not-applicable
- Assigned user set to Martin Gamsjaeger (snusnu)
Felipe,
The password needs to be a String, and there's no conversion done internally. Doing a #to_s conversion might seem tempting at first, but it would probably lead to similar errors when people pass in some kind of object that doesn't represent a proper String.
I'm thinking that YAML automatically converts the number into a Numeric datatype in your case here. A workaround for that would be to just quote it like "12345".
Closing this for now.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »