I've got a table where I used integer on a field which needs decimal places, so I'm trying to create a migration which changes the field type from integer to float/real. My database is sqllite3 and I'm using rails3.
I ran
rails generate migration ChangeMeasureColumnOnIngredients
to create the initial migration files, then updated the class to
class ChangeMeasureColumnOnIngredients < ActiveRecord::Migration def self.up change_column :ingredients, :measure, :real end
I ran rake db:migrate and it returned fine.
When I inserted a value via my rails app, it didn't return the decimal place. I started to think that many rails doesn't know what 'real' is as a datatype, so I changed the migration to
change_column :ingredients, :measure, :float
I then ran
rake db:migrate change_measure_column_on_ingredientsand now I get the following error
c:\Ruby192\rails3rc>rake db:migrate change_measure_column_on_ingredients (in c:/Ruby192/rails3rc) rake aborted! Don't know how to build task 'change_measure_column_on_ingredients' C:/Ruby192/lib/ruby/1.9.1/rake.rb:1720:in[]' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2040:in
invoke_task' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:inblock (2 levels) in top_level' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in
each' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:inblock in top_level' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in
standard_exception_handling' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2013:intop_level' C:/Ruby192/lib/ruby/1.9.1/rake.rb:1992:in
run' C:/Ruby192/bin/rake:31:in `'
I tried changing the :float back to :real, but I still get that error.
can somebody tell me what I'm doing wrong? I'm new to rails and still learning.