Reading Agile Web Development with Rails (2nd edition) Working with InstantRails on Windows XP Professional Sevice Pack 2 I am trying to run a migration using the command rake db:migrate from the command prompt. This is the error I''m getting: rake aborted! You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.[] Any ideas why is this occurring and how I can solve this? Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Chris Johnston
2007-Jan-29 18:10 UTC
Re: rake db:migrate as in Agile Web Development with Rails
On 1/29/07, XBone <alextabone-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Reading Agile Web Development with Rails (2nd edition) > Working with InstantRails on Windows XP Professional Sevice Pack 2 > > I am trying to run a migration using the command > rake db:migrate > from the command prompt. > > This is the error I''m getting: > > rake aborted! > You have a nil object when you didn''t expect it! > You might have expected an instance of Array. > The error occured while evaluating nil.[]I had a similar error. In my case, the problem was that I was trying to alter an existing table by adding a foreign key reference to a table that had existing data in it. I had a previous migration that added some test data for me. Specifically, for me, the problem was that I was trying to explicitly add the constraint in MySQL. I removed the constraint and let rails handle the relationship (probably not the best idea, but I am still learning and playing) and the error went away. Chris -- www.fuzzylizard.com You know you''ve achieved perfection in design, Not when you have nothing more to add, But when you have nothing more to take away. Antoine de Saint-Exupery --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi. Thanks for your reply. However, I have not added constraints through other database interfaces. My migration is named 002_add_price.rb and this is its contents: class AddPrice < ActiveRecord::Migration def self.up add_column :products, :price, :decimal, :precision => 8, :scale => 2, :default => 0 end def self.down remove_column :products, :price end end -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Drew Olson
2007-Jan-29 18:55 UTC
Re: rake db:migrate as in Agile Web Development with Rails
Guest wrote:> Hi. Thanks for your reply. >I had the same issue and it was related to not running Rails 1.2. All examples in the book assume you''re using this version of Rails, not sure if this will be helpful in your case. -- 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-/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 -~----------~----~----~----~------~----~------~--~---
jamiequint-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-29 19:03 UTC
Re: rake db:migrate as in Agile Web Development with Rails
There was the exact same thread on here a few days ago.... Upgrading to 1.2 should fix your problems. Best, Jamie On Jan 29, 10:55 am, Drew Olson <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Guest wrote: > > Hi. Thanks for your reply.I had the same issue and it was related to not running Rails 1.2. All > examples in the book assume you''re using this version of Rails, not sure > if this will be helpful in your case. > > -- > Posted viahttp://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-/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 -~----------~----~----~----~------~----~------~--~---
Yup, I just ran into this yesterday and it was because I was not running 1.2.1. Upgrade and you are good to go. Scott On Jan 29, 1:07 pm, "XBone" <alextab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Reading Agile Web Development with Rails (2nd edition) > Working with InstantRails on Windows XP Professional Sevice Pack 2 > > I am trying to run a migration using the command > rake db:migrate > from the command prompt. > > This is the error I''m getting: > > rake aborted! > You have a nil object when you didn''t expect it! > You might have expected an instance of Array. > The error occured while evaluating nil.[] > > Any ideas why is this occurring and how I can solve this? > > Thanks--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---