Nikos Dimitrakopoulos
2011-Mar-07 10:15 UTC
has_one :dependent => :destroy error (in `configure_dependency_for_has_one'': compile error (SyntaxError))
Hi I''m getting the following error : /Users/nikosd/.rvm/rubies/ree-1.8.7-2011.02/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../bin/rake test Testing started at 12:00 PM ... (in /Users/nikosd/Work/.../.../...) /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activerecord-3.0.5/lib/active_record/associations.rb:1673:in `configure_dependency_for_has_one'': compile error (SyntaxError) /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activerecord-3.0.5/lib/active_record/associations.rb:1672: syntax error, unexpected kIF_MOD, expecting kWHEN association.destroy if association ^ from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activerecord-3.0.5/lib/active_record/associations.rb:1109:in `has_one'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activerecord-3.0.5/lib/active_record/autosave_association.rb:137:in `has_one'' from /Users/nikosd/Work/.../.../.../app/models/fraud_assessment.rb:17 from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:227:in `load_dependency'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:346:in `require_or_load'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:300:in `depend_on'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:216:in `require_dependency'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/engine.rb:138:in `eager_load!'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/engine.rb:137:in `each'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/engine.rb:137:in `eager_load!'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/engine.rb:135:in `each'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/engine.rb:135:in `eager_load!'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/application.rb:108:in `eager_load!'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/application/finisher.rb:41 from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/initializable.rb:25:in `instance_exec'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/initializable.rb:25:in `run'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/initializable.rb:50:in `run_initializers'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/initializable.rb:49:in `each'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/initializable.rb:49:in `run_initializers'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/application.rb:134:in `initialize!'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/application.rb:77:in `send'' from /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'' from /Users/nikosd/Work/.../.../.../config/environment.rb:5 from ./test/test_helper.rb:2:in `require'' from ./test/test_helper.rb:2 from ./test/unit/ability_test.rb:1:in `require'' from ./test/unit/ability_test.rb:1 (...) Errors running test:units, test:functionals! Empty test suite. Process finished with exit code 1 The originating code is the following : class Foo < ActiveRecord::Base has_one :case, :dependent => :destroy end any ideas? I noticed that inside ActiveRecord associations rb file most of the callbacks are defined with "define_method" but this particular section of "configure_dependency_for_has_one" for :destroy, :delete and :nullify is with class_eval and some string mangling. Could this be a bug or am I doing something wrong? -- 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.
Nikos Dimitrakopoulos
2011-Mar-07 10:32 UTC
Re: has_one :dependent => :destroy error (in `configure_dependency_for_has_one'': compile error (SyntaxError))
lol, I knew that the "Case" model was going to bite me at some point :) On Monday, March 7, 2011 12:15:50 PM UTC+2, Nikos Dimitrakopoulos wrote:> > Hi I''m getting the following error : > > /Users/nikosd/.rvm/rubies/ree-1.8.7-2011.02/bin/ruby -e > $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../bin/rake test > Testing started at 12:00 PM ... > (in /Users/nikosd/Work/.../.../...) > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activerecord-3.0.5/lib/active_record/associations.rb:1673:in > `configure_dependency_for_has_one'': compile error (SyntaxError) > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activerecord-3.0.5/lib/active_record/associations.rb:1672: > syntax error, unexpected kIF_MOD, expecting kWHEN > association.destroy if association > ^ > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activerecord-3.0.5/lib/active_record/associations.rb:1109:in > `has_one'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activerecord-3.0.5/lib/active_record/autosave_association.rb:137:in > `has_one'' > from /Users/nikosd/Work/.../.../.../app/models/fraud_assessment.rb:17 > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in > `require'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in > `require'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:227:in > `load_dependency'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in > `require'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:346:in > `require_or_load'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:300:in > `depend_on'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/activesupport-3.0.5/lib/active_support/dependencies.rb:216:in > `require_dependency'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/engine.rb:138:in > `eager_load!'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/engine.rb:137:in > `each'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/engine.rb:137:in > `eager_load!'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/engine.rb:135:in > `each'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/engine.rb:135:in > `eager_load!'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/application.rb:108:in > `eager_load!'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/application/finisher.rb:41 > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/initializable.rb:25:in > `instance_exec'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/initializable.rb:25:in > `run'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/initializable.rb:50:in > `run_initializers'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/initializable.rb:49:in > `each'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/initializable.rb:49:in > `run_initializers'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/application.rb:134:in > `initialize!'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/application.rb:77:in > `send'' > from > /Users/nikosd/.rvm/gems/ree-1.8.7-2011.02@.../gems/railties-3.0.5/lib/rails/application.rb:77:in > `method_missing'' > from /Users/nikosd/Work/.../.../.../config/environment.rb:5 > from ./test/test_helper.rb:2:in `require'' > from ./test/test_helper.rb:2 > from ./test/unit/ability_test.rb:1:in `require'' > from ./test/unit/ability_test.rb:1 > (...) > Errors running test:units, test:functionals! > Empty test suite. > Process finished with exit code 1 > > The originating code is the following : > > class Foo < ActiveRecord::Base > > has_one :case, :dependent => :destroy > > end > > any ideas? > > I noticed that inside ActiveRecord associations rb file most of the > callbacks are defined with "define_method" but this particular section of > "configure_dependency_for_has_one" for :destroy, :delete and :nullify is > with class_eval and some string mangling. Could this be a bug or am I doing > something wrong? >-- 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.