This project is archived and is in readonly mode.
has_and_belongs_to_many cannot use consistently use find or include?
Reported by David Liu | October 31st, 2008 @ 05:57 PM | in 2.x
I have defined
has_and_belongs_to_many :update_sites, :uniq => true
And when trying to do:
if (! update_sites.include?(site))
puts "attach RU " + self.build_fullname + " to site " + site.url
update_sites << site
end
Got:
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in
log': Mysql::Error: Can't create/write to file
'C:\MySQL5\tmp\#sql_190_0.MYI' (Errcode: 13): SHOW FIELDS
FROM
release_unit_builds_update_sites(ActiveRecord::StatementInvalid)
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:281:in `execute'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:411:in `columns'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/has_and_belongs_to_many_association.rb:147:in `finding_with_ambiguous_select?'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/has_and_belongs_to_many_association.rb:50:in `find'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/association_collection.rb:182:in `find_target'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/association_proxy.rb:133:in `load_target'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/association_proxy.rb:124:in `method_missing'
from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/association_collection.rb:162:in `method_missing'
from C:/RubyProjects/osgiruby/app/models/release_unit_build.rb:32:in `add_site'
from C:/RubyProjects/osgiruby/db/script/load_db.rb:155:in `fetch_all_features'
from C:/RubyProjects/osgiruby/db/script/load_db.rb:146:in `each'
from C:/RubyProjects/osgiruby/db/script/load_db.rb:146:in `fetch_all_features'
from C:/RubyProjects/osgiruby/db/script/load_db.rb:142:in `each'
from C:/RubyProjects/osgiruby/db/script/load_db.rb:142:in `fetch_all_features'
from C:/RubyProjects/osgiruby/db/script/load_db.rb:245
The error happens on the include? test. Using find having similar issue.
Not sure if it is a known issue or usage error.
Comments and changes to this ticket
-
gaffo October 31st, 2008 @ 07:20 PM
This is typically because a virus scanner is scanning your tmp file at the same time that you are trying to run this. Make sure nothing else has this file open or add an exception to the scanner so it doesn't hit it. I had this same issue with mysql and my corporate anti virus. I had to move the tmp file to another directory and get an exception added to that file.
-
gaffo October 31st, 2008 @ 07:40 PM
Check this blog post for more info: http://blog.confabulus.com/2008/...
-
Frederick Cheung December 12th, 2008 @ 04:40 PM
- State changed from new to invalid
Nothing to do with rails :-)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>