Hi all, I just upgraded to Rails 2.0.2 on os x 10.5.2 by doing "sudo gem install rails --include-dependencies". Just to play around, I create a simple application by doing this: rails -d mysql TestRails2 Then I created some scaffolding: script/generate scaffold player integer:number string:name then I do the following: rake db:create:all; (which successfully creates my databases) rake db:migrate; This fails with the following error: == 1 CreatePlayers: migrating ================================================-- create_table(:players) rake aborted! undefined method `number'' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x175b8f8> It seems like this is some sort of problem with the sexy migration syntax that it can''t find the "number" method. Here''s the migrate file: class CreatePlayers < ActiveRecord::Migration def self.up create_table :players do |t| t.number :integer t.name :string t.timestamps end end def self.down drop_table :players end end I thought that perhaps ActiveRecord hadn''t been upgraded along with rails but I ran the server and checked gems versions and everything is updated to 2.0.2 Any ideas? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Just tried by creating another project using sqlite3 instead of mysql (thought there might be a problem with the mysql connector) but I got the exact same error. Grr. On Feb 18, 10:42 pm, Jon Loyens <jonloy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > > I just upgraded to Rails 2.0.2 on os x 10.5.2 by doing "sudo gem > install rails --include-dependencies". > > Just to play around, I create a simple application by doing this: > > rails -d mysql TestRails2 > > Then I created some scaffolding: > > script/generate scaffold player integer:number string:name > > then I do the following: > > rake db:create:all; (which successfully creates my databases) > rake db:migrate; > > This fails with the following error: > > == 1 CreatePlayers: migrating > ================================================> -- create_table(:players) > rake aborted! > undefined method `number'' for > #<ActiveRecord::ConnectionAdapters::TableDefinition:0x175b8f8> > > It seems like this is some sort of problem with the sexy migration > syntax that it can''t find the "number" method. Here''s the migrate > file: > > class CreatePlayers < ActiveRecord::Migration > def self.up > create_table :players do |t| > t.number :integer > t.name :string > > t.timestamps > end > end > > def self.down > drop_table :players > end > end > > I thought that perhaps ActiveRecord hadn''t been upgraded along with > rails but I ran the server and checked gems versions and everything is > updated to 2.0.2 > > Any ideas?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''ve now found the problem... I had a transposed the type and name of the fields in the scaffold generation. D''oh! On Feb 18, 10:58 pm, Jon Loyens <jonloy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Just tried by creating another project using sqlite3 instead of mysql > (thought there might be a problem with the mysql connector) but I got > the exact same error. Grr. > > On Feb 18, 10:42 pm, Jon Loyens <jonloy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi all, > > > I just upgraded to Rails 2.0.2 on os x 10.5.2 by doing "sudo gem > > install rails --include-dependencies". > > > Just to play around, I create a simple application by doing this: > > > rails -d mysql TestRails2 > > > Then I created some scaffolding: > > > script/generate scaffold player integer:number string:name > > > then I do the following: > > > rake db:create:all; (which successfully creates my databases) > > rake db:migrate; > > > This fails with the following error: > > > == 1 CreatePlayers: migrating > > ================================================> > -- create_table(:players) > > rake aborted! > > undefined method `number'' for > > #<ActiveRecord::ConnectionAdapters::TableDefinition:0x175b8f8> > > > It seems like this is some sort of problem with the sexy migration > > syntax that it can''t find the "number" method. Here''s the migrate > > file: > > > class CreatePlayers < ActiveRecord::Migration > > def self.up > > create_table :players do |t| > > t.number :integer > > t.name :string > > > t.timestamps > > end > > end > > > def self.down > > drop_table :players > > end > > end > > > I thought that perhaps ActiveRecord hadn''t been upgraded along with > > rails but I ran the server and checked gems versions and everything is > > updated to 2.0.2 > > > Any ideas?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---