I guess my questoin to you would be is there such a column called 'tag_id' in you customers table?  If not then this is where the issue lies as the mysql errors states that it cannot find the field in when the query is ran.
<br><br>Thanks<br><br>Jason L. West, Sr.<br><br><div><span class="gmail_quote">On 3/31/06, <b class="gmail_sendername">Julian Leviston</b> &lt;<a href="mailto:julian@coretech.net.au">julian@coretech.net.au</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello list,<br><br>I've had this problem for two days now. Perhaps someone here would<br>care to comment on it. I'd be REALLY appreciative if that'd be the case.
<br><br>Basically, it's outlined at this paste: <a href="http://rafb.net/paste/results/">http://rafb.net/paste/results/</a><br>kXQSHZ83.html<br><br>But I'll paste it here, too.<br><br>The main problem is in the customers/list action. The problem is with
<br>this line:<br>@customer_pages, @customers = paginate :customers, {:per_page =&gt;<br>10, :include =&gt; 'tags', :conditions=&gt;'tag_id = 3'}<br><br>It's generating the exception below. Any help would be INCREDIBLY<br>
appreciated. Please b/cc me in on any replies.<br><br>Kind Regards,<br>Julian.<br><br><br><br>#The problem is in the customer-list action.<br>#... it yields the error below the source code that follows:<br># source code follows:
<br><br>class CreateCustomers &lt; ActiveRecord::Migration<br>&nbsp;&nbsp; def self.up<br>&nbsp;&nbsp;&nbsp;&nbsp; create_table :customers do |t|<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # t.column :name, :string<br>&nbsp;&nbsp;&nbsp;&nbsp; end<br>&nbsp;&nbsp; end<br><br>&nbsp;&nbsp; def self.down<br>&nbsp;&nbsp;&nbsp;&nbsp; drop_table :customers
<br>&nbsp;&nbsp; end<br>end<br><br>class CreateTags &lt; ActiveRecord::Migration<br>&nbsp;&nbsp; def self.up<br>&nbsp;&nbsp;&nbsp;&nbsp; create_table :tags do |t|<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # t.column :name, :string<br>&nbsp;&nbsp;&nbsp;&nbsp; end<br>&nbsp;&nbsp; end<br><br>&nbsp;&nbsp; def self.down<br>&nbsp;&nbsp;&nbsp;&nbsp; drop_table :tags
<br>&nbsp;&nbsp; end<br>end<br><br><br>class Customer &lt; ActiveRecord::Base<br>&nbsp;&nbsp; has_and_belongs_to_many :tags<br>end<br><br>class Tag &lt; ActiveRecord::Base<br>&nbsp;&nbsp; has_and_belongs_to_many :customers<br>end<br><br><br>class CustomersController &lt; ApplicationController
<br>&nbsp;&nbsp; def index<br>&nbsp;&nbsp;&nbsp;&nbsp; list<br>&nbsp;&nbsp;&nbsp;&nbsp; render :action =&gt; 'list'<br>&nbsp;&nbsp; end<br><br>&nbsp;&nbsp; # GETs should be safe (see <a href="http://www.w3.org/2001/tag/doc/">http://www.w3.org/2001/tag/doc/</a><br>whenToUseGet.html)<br>&nbsp;&nbsp; verify :method =&gt; :post, :only =&gt; [ :destroy, :create, :update ],
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:redirect_to =&gt; { :action =&gt; :list }<br><br>&nbsp;&nbsp; def list<br>&nbsp;&nbsp;&nbsp;&nbsp; @customer_pages, @customers = paginate :customers, {:per_page =&gt;<br>10, :include =&gt; 'tags', :conditions=&gt;'tag_id = 3'}<br>&nbsp;&nbsp; end
<br><br>&nbsp;&nbsp; def show<br>&nbsp;&nbsp;&nbsp;&nbsp; @customer = Customer.find(params[:id])<br>&nbsp;&nbsp; end<br><br>&nbsp;&nbsp; def new<br>&nbsp;&nbsp;&nbsp;&nbsp; @customer = Customer.new<br>&nbsp;&nbsp; end<br><br>&nbsp;&nbsp; def create<br>&nbsp;&nbsp;&nbsp;&nbsp; @customer = Customer.new(params[:customer])<br>&nbsp;&nbsp;&nbsp;&nbsp; if @
customer.save<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flash[:notice] = 'Customer was successfully created.'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; redirect_to :action =&gt; 'list'<br>&nbsp;&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; render :action =&gt; 'new'<br>&nbsp;&nbsp;&nbsp;&nbsp; end<br>&nbsp;&nbsp; end<br><br>&nbsp;&nbsp; def edit<br>&nbsp;&nbsp;&nbsp;&nbsp; @customer = 
Customer.find(params[:id])<br>&nbsp;&nbsp; end<br><br>&nbsp;&nbsp; def update<br>&nbsp;&nbsp;&nbsp;&nbsp; @customer = Customer.find(params[:id])<br>&nbsp;&nbsp;&nbsp;&nbsp; if @customer.update_attributes(params[:customer])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flash[:notice] = 'Customer was successfully updated.'
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; redirect_to :action =&gt; 'show', :id =&gt; @customer<br>&nbsp;&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; render :action =&gt; 'edit'<br>&nbsp;&nbsp;&nbsp;&nbsp; end<br>&nbsp;&nbsp; end<br><br>&nbsp;&nbsp; def destroy<br>&nbsp;&nbsp;&nbsp;&nbsp; Customer.find(params[:id]).destroy<br>&nbsp;&nbsp;&nbsp;&nbsp; redirect_to :action =&gt; 'list'
<br>&nbsp;&nbsp; end<br>end<br><br><br># exception that is generated when trying to access list page:<br><br>Processing CustomersController#list (for <a href="http://127.0.0.1">127.0.0.1</a> at 2006-04-01<br>00:40:10) [GET]<br>&nbsp;&nbsp; Session ID: ee0f5f8afb0b2740be5f9463b8962e0b
<br>&nbsp;&nbsp; Parameters: {&quot;action&quot;=&gt;&quot;list&quot;, &quot;controller&quot;=&gt;&quot;customers&quot;}<br>&nbsp;&nbsp; Customer Count (0.000700)&nbsp;&nbsp; SELECT COUNT(DISTINCT <a href="http://customers.id">customers.id</a>)<br>FROM customers LEFT OUTER JOIN customers_tags ON
<br>customers_tags.customer_id = <a href="http://customers.id">customers.id</a> LEFT OUTER JOIN tags ON<br><a href="http://tags.id">tags.id</a> = customers_tags.tag_id WHERE (tag_id = 3)<br>&nbsp;&nbsp; Customer Columns (0.000248)&nbsp;&nbsp; SHOW FIELDS FROM customers
<br>&nbsp;&nbsp; Tag Columns (0.000186)&nbsp;&nbsp; SHOW FIELDS FROM tags<br>&nbsp;&nbsp; Customer Load IDs For Limited Eager Loading (0.000000)<br>Mysql::Error: Unknown column 'tag_id' in 'where clause': SELECT id<br>FROM customers WHERE (tag_id = 3) LIMIT 0, 10
<br><br><br>ActiveRecord::StatementInvalid (Mysql::Error: Unknown column 'tag_id'<br>in 'where clause': SELECT id FROM customers WHERE (tag_id = 3)&nbsp;&nbsp;LIMIT<br>0, 10):<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/activerecord-
1.14.0/lib/<br>active_record/connection_adapters/abstract_adapter.rb:120:in `log'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/<br>active_record/connection_adapters/mysql_adapter.rb:185:in `execute'<br>
&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/<br>active_record/connection_adapters/mysql_adapter.rb:337:in `select'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/<br>active_record/connection_adapters/mysql_adapter.rb:176:in `select_all'
<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/<br>active_record/connection_adapters/abstract/database_statements.rb:<br>23:in `select_values'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0
/lib/<br>active_record/associations.rb:1147:in `select_limited_ids_list'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/<br>active_record/associations.rb:1141:in `add_limited_ids_condition!'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/activerecord-
1.14.0/lib/<br>active_record/associations.rb:1131:in<br>`construct_finder_sql_with_included_associations'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/<br>active_record/associations.rb:1094:in `select_all_rows'
<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/<br>active_record/associations.rb:960:in `find_with_associations'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/<br>active_record/base.rb:923:in `find_every'
<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/<br>active_record/base.rb:381:in `find'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/<br>action_controller/pagination.rb:182:in `find_collection_for_pagination'
<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/<br>action_controller/pagination.rb:198:in `paginator_and_collection_for'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/<br>action_controller/pagination.rb:129:in `paginate'
<br>&nbsp;&nbsp;&nbsp;&nbsp; /app/controllers/customers_controller.rb:12:in `list'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/<br>action_controller/base.rb:908:in `perform_action_without_filters'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-
1.12.0/lib/<br>action_controller/filters.rb:355:in `perform_action_without_benchmark'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/<br>action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/<br>action_controller/benchmarking.rb:69:in `perform_action_without_rescue'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-
1.12.0/lib/<br>action_controller/rescue.rb:82:in `perform_action'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/<br>action_controller/base.rb:379:in `process_without_filters'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-
1.12.0/lib/<br>action_controller/filters.rb:364:in<br>`process_without_session_management_support'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/<br>action_controller/session_management.rb:117:in `process'
<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/dispatcher.rb:<br>38:in `dispatch'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/<br>fcgi_handler.rb:150:in `process_request'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/rails-
1.1.0/lib/<br>fcgi_handler.rb:54:in `process!'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:600:in `each_cgi'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/rails-
1.1.0/lib/<br>fcgi_handler.rb:53:in `process!'<br>&nbsp;&nbsp;&nbsp;&nbsp; /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/<br>fcgi_handler.rb:23:in `process!'<br>&nbsp;&nbsp;&nbsp;&nbsp; /Users/julian/rails/test/public/dispatch.fcgi:24<br><br><br>Rendering /usr/local/lib/ruby/gems/1.8/gems/actionpack-
1.12.0/lib/<br>action_controller/templates/rescues/layout.rhtml (500 Internal Error)<br>_______________________________________________<br>Rails mailing list<br><a href="mailto:Rails@lists.rubyonrails.org">Rails@lists.rubyonrails.org
</a><br><a href="http://lists.rubyonrails.org/mailman/listinfo/rails">http://lists.rubyonrails.org/mailman/listinfo/rails</a><br></blockquote></div>