Dominic Marks
2005-Feb-04 18:45 UTC
has_and_belongs_to_many + syntax error !end(force_reload).nil? ^
This is bound to be a simple one, since I''ve got such a little code. app/models/application.rb \\ class Application < ActiveRecord::Base has_and_belongs_to_many :devices has_and_belongs_to_many :comments has_and_belongs_to_many :problems end // http://<server>/assistant/show \\ (eval):5:in `has_and_belongs_to_many'' /app/models/application.rb:2 // framework trace \\ compile error /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/depre cated_associations.rb:83: syntax error !end(force_reload).nil? ^ /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/supp ort/dependencies.rb:24:in `depend_on'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/sup port/dependencies.rb:30:in `associate_with'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/sup port/dependencies.rb:48:in `require_association'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/sup port/dependencies.rb:48:in `require_association'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/assoc iations.rb:580:in `require_association_class'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/assoc iations.rb:467:in `has_and_belongs_to_many_without_reflection'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/sup port/dependencies.rb:38:in `load'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/sup port/dependencies.rb:38:in `require_or_load'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/sup port/dependencies.rb:46:in `require_or_load'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/sup port/dependencies.rb:46:in `require_or_load'' /usr/local/lib/ruby/gems/1.8/gems/rails-0.9.5/lib/dispatcher.rb:37:in `dispatch'' /var/www/overview/public/dispatch.cgi:10 // I''m new to ruby and rails and totally baffled by the error message. Especially since the Application class isn''t related to the Assistant class. Other classes, SQL definitions, etc available if they can be of any use. Thanks for any cluestick beatings administered, -- Dom
Tim Bates
2005-Feb-04 22:26 UTC
Re: has_and_belongs_to_many + syntax error !end(force_reload).nil? ^
Dominic Marks wrote:> compile error > /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/depre > cated_associations.rb:83: syntax error !end(force_reload).nil? ^This is a syntax error being caused in some dynamic code generation stuff. You appear to have a has_one or belongs_to association called "end". "end" is a reserved word in Ruby and so you get a syntax error when it tries to construct the call to !#{association_name}(force_reload).nil? Rename whatever association you have called "end" and all should work. Tim. -- Tim Bates tim-kZbwfhiKUx26c6uEtOJ/EA@public.gmane.org
Dominic Marks
2005-Feb-08 23:55 UTC
Re: has_and_belongs_to_many + syntax error !end(force_reload).nil? ^
On Friday 04 February 2005 22:26, Tim Bates wrote:> Dominic Marks wrote: > > compile error > > > > /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/de > >pre cated_associations.rb:83: syntax error !end(force_reload).nil? ^ > > This is a syntax error being caused in some dynamic code generation > stuff. You appear to have a has_one or belongs_to association called > "end". "end" is a reserved word in Ruby and so you get a syntax error > when it tries to construct the call to > !#{association_name}(force_reload).nil?I had a method called and end and a controller/model called Application. Talk about stupid :-)> Rename whatever association you have called "end" and all should work. > > Tim.Thanks Tim. -- Dominic