This project is archived and is in readonly mode.
Rails 2.2.2 looking for column that does not exist
Reported by Patrick | February 1st, 2009 @ 02:24 AM | in 2.x
Hi, I recently upgraded from Rails 2.0.2 to 2.1.2 with no problems, then I moved from 2.1.2 to 2.2.2 and have been noticing this strange error.
Mysql::Error: Unknown column 'domain_listings.id' in 'field
list': SELECT domain_listings
.id FROM
domain_listings
WHERE
(domain_listings
.domain_id
= 2 AND
domain_listings
.listing_id = 12) LIMIT 1
domain_listings is a join table and id does not exist, the columns are domain_id and listing_id. As I mentioned, no problem with this in 2.1.2. Any guidance would be appreciated.
Comments and changes to this ticket
-
Scott Taylor February 1st, 2009 @ 05:13 AM
Can you provide more information? What is the schema of those two tables? What AR call is triggering this query?
-
Patrick February 1st, 2009 @ 05:56 AM
This is the code from the form that is creating the sql
<%= select_tag('domain_listings[domain_id][]', options_from_collection_for_select(Domain.find(:all), 'id', 'name', @listing.domains.collect {|d| d.id}), :multiple => true, :size => 5
I've also attached part of my dev log file that shows the error. As I mentioned, the query worked up to 2.1.2 and then broke when I upgraded to 2.2.2. Thanks for the quick response...
-
Patrick February 14th, 2009 @ 07:14 PM
Just wondered if anyone had a chance to look at this yet? right now I'm sticking to rails 2.1.2 until I at least have a work around. Maybe I need to find a way for it to write a different sql.
-
siong1987 February 15th, 2009 @ 02:35 AM
Since the information that you provided is not really enough, you can try this:
class DomainListing < ActiveRecord::Base belongs_to :listing belongs_to :domain, :foreign_key => 'domain_id' end
-
Pratik March 8th, 2009 @ 01:26 PM
- Assigned user changed from Frederick Cheung to Pratik
- State changed from new to invalid
You should try to submit a failing test case. http://guides.rails.info/contrib... might come handy!
Thanks.
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>