Opened 18 years ago
Closed 18 years ago
#4843 closed defect (invalid)
attempted to create bug report in railonruby site - got oops internal error
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | general | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
loading this info to rubyonrails bug trac site caused the error
called preview - wnnt back to delete a single char typo then submitted the report - Oops!
I am attempting to setup a belongs_to / has_many relationship and the resulting where clause is wrong:
ruby code
require "rubygems" require_gem "activerecord" require "pp" ActiveRecord::Base.establish_connection( :adapter => "mysql", :host => "devbox..internal", :database => "test2", :username => "XXX", :password => "XXXpassword" ) class Job < ActiveRecord::Base # doesnt have id as the primary key set_primary_key "jobid" has_many :audits end class Audit < ActiveRecord::Base set_table_name "job_audit" # legacy name belongs_to :job, :class_name => "Job", :foreign_key => "jobid" end jj = Job.find(900000) pp jj jj.audits.each do |ja| pp ja end
what I get is this
ttyp6 > ruby report.rb #<Job:0x810d760 @attributes= {"doa"=>"0", "item_id"=>"0", "faultid"=>"3110", "status"=>"CLOSED", "proj_mustfinish"=>"0000-00-00 00:00:00", ... omitted columns ... "jobid"=>"900000", "partid"=>"0", "resp_ts"=>"10:42:00", ... omitted columns ... "escalation"=>"0"}>
which is the correct job record and then this
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/ active_record/connection_adapters/abstract_adapter.rb:128:in `log': Mysql::Error: Unknown column 'job_audit.job_id' in 'where clause': SELECT * FROM job_audit WHERE (job_audit.job_id = 900000) (ActiveRecord::StatementInvalid) from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/ active_record/connection_adapters/mysql_adapter.rb:243:in `execute' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/ active_record/connection_adapters/mysql_adapter.rb:395:in `select' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/ active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/ active_record/base.rb:424:in `find_by_sql' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/ active_record/base.rb:994:in `find_every' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/ active_record/base.rb:415:in `find' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/ active_record/associations/has_many_association.rb:91:in `find' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/ active_record/associations/association_collection.rb:159:in `find_target' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/ active_record/associations/has_many_association.rb:123:in `load_target' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/ active_record/associations/association_proxy.rb:122:in `method_missing' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/ active_record/associations/has_many_association.rb:98:in `method_missing' from report.rb:35
From my understanding of the belongs_to / has_many options and the legacy renaming of the id field the where clause above should be
SELECT * FROM job_audit WHERE (job_audit.jobid = 900000)
not
SELECT * FROM job_audit WHERE (job_audit.job_id = 900000)
what am i doing wrong?
Traceback (most recent call last):
File "/opt/csw/lib/python2.3/site-packages/trac/web/main.py", line 387, in dispatch_request dispatcher.dispatch(req) File "/opt/csw/lib/python2.3/site-packages/trac/web/main.py", line 244, in dispatch req.display(template, content_type or 'text/html') File "/opt/csw/lib/python2.3/site-packages/trac/web/api.py", line 358, in display data = self.hdf.render(template, form_token) File "/opt/csw/lib/python2.3/site-packages/trac/web/clearsilver.py", line 290, in render template.parseFile(filename) ParseError: ParseError: [/home/dev.rubyonrails.org/tracs/rails/templates/site_header.cs:1] Duplicate macro def for navlink(text, href, id, aclname, accesskey)
Attachments (0)
Change History (2)
comment:1 by , 18 years ago
Description: | modified (diff) |
---|
comment:2 by , 18 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
The first part of the description is not related to Trac.
The Python traceback however seems to indicate an error in the web site configuration/installation. You need to contact the admin of rubyonrails to report this error.