Ruby on Rails Thursday, January 12, 2012

Precisio wrote in post #1040594:
> Ignore my plea. It turns out I have the wrong precision on the table
> columns. Even though they were indeed decimals, rails saw the 0 scale
> on the table column and thought that they were integers. Dang, that's
> a gotcha!

This is why I always specify precision and scale in my migrations:

t.decimal :price, :precision => 10, :scale => 2

This removes any confusion between the migration and database schema.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment