This project is archived and is in readonly mode.
ActiveRecord: PostgreSQL floats returned as Strings; SQLite floats returned as floats
-
Utkarsh Kukreti
What do you have in your
schema.rb? A similar piece of code works fine for me on Heroku/PostgreSQL -
Hans Engel
This is the relevant table in
schema.rb:create_table "records", :force => true do |t| t.integer "user_id" t.integer "profile_id" t.integer "words" t.integer "duration" t.integer "wpm" t.integer "cpm" t.datetime "created_at" t.datetime "updated_at" endThe columns
wpmandcpmwere being returned asStrings. Maybe because I was using an integer type in my migrations instead of specifying a float type? -
Utkarsh Kukreti
Yes. That should have been
t.float. I'm guessing the data was imported as-is into PostgreSQL, which made the fields behave like String, as they had an invalid value for their column. Could you try again witht.float?