small medium large xlarge

Drp_pragsmall
08 Aug 2008, 19:43
Dan Pendergrass (11 posts)

Trying to figure out how/why rake is able to access a “method” that doesn’t exist in my current project.

getting the following error when I issue the rake db:migrate command

rake aborted! undefined method `name’ for #

Now there is no reference to name in the depot project, but I was doing another tutorial prior to this that did have a column/field in a different mysql database called name. The project is in a different directory.

Unless there is something else going on it appears that the rake command is somehow dragging the reference to the other tutorial.

I’m doing this in Win XP SP3 with mysql 5.0. If anyone can give me an idea of what might be going here I’d really appreciate it. I’ve moved all the directories out of the ruby path associated with the old project to no avail. The following is my trace.

C:\rubydev\ch07\depot>rake db:migrate –trace (in C:/rubydev/ch07/depot) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate == 20080808165902 AddTestData: migrating ====================================== rake aborted! undefined method name' for #<Product:0x3e8d1d8> C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/attribute_me thods.rb:256:in method_missing’ C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/validations. rb:356:in send' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/validations. rb:356:in validates_each’ C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/validations. rb:355:in each' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/validations. rb:355:in validates_each’ C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks. rb:177:in call' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks. rb:177:in evaluate_method’ C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks. rb:161:in call' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks. rb:90:in run’ C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks. rb:90:in each' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks. rb:90:in send’ C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks. rb:90:in run' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks. rb:272:in run_callbacks’ C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/validations. rb:929:in valid_without_callbacks?' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/callbacks.rb :267:in valid?’ C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/validations. rb:900:in save_without_dirty' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/dirty.rb:75: in save_without_transactions’ C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions .rb:106:in save' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_a dapters/abstract/database_statements.rb:66:in transaction’ C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions .rb:79:in transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions .rb:98:in transaction’ C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions .rb:106:in save' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions .rb:118:in rollback_active_record_state!’ C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/transactions .rb:106:in save' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:640: in create’ ./db/migrate//20080808165902_add_test_data.rb:14:in up_without_benchmarks' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb :264:in send’ C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb :264:in migrate' C:/ruby/lib/ruby/1.8/benchmark.rb:293:in measure’ C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb :264:in migrate' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb :430:in migrate’ C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb :420:in each' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb :420:in migrate’ C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb :357:in up' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/migration.rb :340:in migrate’ C:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/tasks/databases.rake:99 C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in call' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in execute’ C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in each' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in execute’ C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in invoke_with_call_c hain' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in synchronize’ C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in invoke_with_call_c hain' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in invoke’ C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in invoke_task' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in top_level’ C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in each' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in top_level’ C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in standard_exceptio n_handling' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in top_level’ C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in run' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in standard_exceptio n_handling’ C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in run' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31 C:/ruby/bin/rake:16:in load’ C:/ruby/bin/rake:16

I could just pump these in by hand, but I’d really like to know if there’s a bug here.

Thanks

Drp_pragsmall
08 Aug 2008, 20:18
Dan Pendergrass (11 posts)

Never mind. I figured it out.

Stevehead_pragsmall
15 Aug 2008, 15:14
Stephen Shockey (2 posts)

Dan:

I have a similar problem to the one you were experiencing. I get the undefined method error for the a table I just created when attempting to load test data.

How did you solve it?

You must be logged in to comment