Hi-- I''m trying to do a first migration (2.3.5). I generated a model "Video", but when I try to migrate I get "uninitialized constant Videos". Why is it trying to find a plural class name? Here''s more complete output: trans@logisys:models$ rake db:migrate --trace ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate rake aborted! An error has occurred, this and all later migrations canceled: uninitialized constant Videos /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ dependencies.rb:443:in `load_missing_constant'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ dependencies.rb:80:in `const_missing'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ dependencies.rb:92:in `const_missing'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ inflector.rb:361:in `constantize'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ inflector.rb:360:in `each'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ inflector.rb:360:in `constantize'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ core_ext/string/inflections.rb:162:in `constantize'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ migration.rb:374:in `load_migration'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ migration.rb:369:in `migration'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ migration.rb:365:in `migrate'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ migration.rb:486:in `migrate'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ migration.rb:560:in `call'' ... -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 18 March 2010 19:32, trans <transfire-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi-- > > I''m trying to do a first migration (2.3.5). I generated a model > "Video", but when I try to migrate I get "uninitialized constant > Videos". Why is it trying to find a plural class name? > > Here''s more complete output: > > trans@logisys:models$ rake db:migrate --trace > ** Invoke db:migrate (first_time) > ** Invoke environment (first_time) > ** Execute environment > ** Execute db:migrate > rake aborted! > An error has occurred, this and all later migrations canceled: > > uninitialized constant Videos > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > dependencies.rb:443:in `load_missing_constant'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > dependencies.rb:80:in `const_missing'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > dependencies.rb:92:in `const_missing'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > inflector.rb:361:in `constantize'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > inflector.rb:360:in `each'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > inflector.rb:360:in `constantize'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > core_ext/string/inflections.rb:162:in `constantize'' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ > migration.rb:374:in `load_migration'' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ > migration.rb:369:in `migration'' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ > migration.rb:365:in `migrate'' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ > migration.rb:486:in `migrate'' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ > migration.rb:560:in `call''It might be helpful if you showed us the code of the migration that adds the table. However I suspect the problem is down to class/table name. The model should be in video.rb and should be class Video The table should be called videos (plural and lower case) If you think you have that right post the code you have written for the migration. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 18, 7:32 pm, trans <transf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi-- > > I''m trying to do a first migration (2.3.5). I generated a model > "Video", but when I try to migrate I get "uninitialized constant > Videos". Why is it trying to find a plural class name? >Is you migration file called 2010031812456_videos.rb by any chance ? (the numbers will be different). If so then rails assumes that the migration file will define a subclass of ActiveRecord::Migration with the same name as the end of the migration filename. Fred> Here''s more complete output: > > trans@logisys:models$ rake db:migrate --trace > ** Invoke db:migrate (first_time) > ** Invoke environment (first_time) > ** Execute environment > ** Execute db:migrate > rake aborted! > An error has occurred, this and all later migrations canceled: > > uninitialized constant Videos > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > dependencies.rb:443:in `load_missing_constant'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > dependencies.rb:80:in `const_missing'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > dependencies.rb:92:in `const_missing'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > inflector.rb:361:in `constantize'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > inflector.rb:360:in `each'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > inflector.rb:360:in `constantize'' > /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ > core_ext/string/inflections.rb:162:in `constantize'' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ > migration.rb:374:in `load_migration'' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ > migration.rb:369:in `migration'' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ > migration.rb:365:in `migrate'' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ > migration.rb:486:in `migrate'' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ > migration.rb:560:in `call'' > ...-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
On Mar 18, 6:25 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is you migration file called 2010031812456_videos.rb by any chance ? > (the numbers will be different). If so then rails assumes that the > migration file will define a subclass of ActiveRecord::Migration with > the same name as the end of the migration filename.That was it. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.