LOL!<br><br><div><span class="gmail_quote">On 3/31/06, <b class="gmail_sendername">Julian Leviston</b> <<a href="mailto:julian@coretech.net.au">julian@coretech.net.au</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hmmm it seems incredibly slow tho... :(<br><br><br>On 01/04/2006, at 1:41 AM, Julian Leviston wrote:<br><br>> Jason,<br>><br>> Did you notice that there is an :include => 'tags' section in the<br>> hash as passed in to the pagination request?
<br>><br>> Oh.. it should be <a href="http://tags.id">tags.id</a> = 2 , shouldn't it?<br>><br>> ARGH... <grinz><br>><br>> Julian.<br>><br>> On 01/04/2006, at 12:58 AM, Jason West wrote:<br>>
<br>>> I guess my questoin to you would be is there such a column called<br>>> 'tag_id' in you customers table? If not then this is where the<br>>> issue lies as the mysql errors states that it cannot find the
<br>>> field in when the query is ran.<br>>><br>>> Thanks<br>>><br>>> Jason L. West, Sr.<br>>><br>>> On 3/31/06, Julian Leviston <<a href="mailto:julian@coretech.net.au">julian@coretech.net.au
</a>> wrote: Hello<br>>> 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<br>>> case.
<br>>><br>>> Basically, it's outlined at this paste: <a href="http://rafb.net/paste/">http://rafb.net/paste/</a><br>>> results/<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 =><br>>> 10, :include => 'tags', :conditions=>'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 < ActiveRecord::Migration
<br>>> def self.up<br>>> create_table :customers do |t|<br>>> # t.column :name, :string<br>>> end<br>>> end<br>>><br>>> def self.down<br>>> drop_table :customers
<br>>> end<br>>> end<br>>><br>>> class CreateTags < ActiveRecord::Migration<br>>> def self.up<br>>> create_table :tags do |t|<br>>> # t.column :name, :string<br>
>> end<br>>> end<br>>><br>>> def self.down<br>>> drop_table :tags<br>>> end<br>>> end<br>>><br>>><br>>> class Customer < ActiveRecord::Base
<br>>> has_and_belongs_to_many :tags<br>>> end<br>>><br>>> class Tag < ActiveRecord::Base<br>>> has_and_belongs_to_many :customers<br>>> end<br>>><br>>><br>>> class CustomersController < ApplicationController
<br>>> def index<br>>> list<br>>> render :action => 'list'<br>>> end<br>>><br>>> # 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>>> verify :method => :post, :only => [ :destroy, :create, :update ],<br>>> :redirect_to => { :action => :list }<br>>><br>>> def list
<br>>> @customer_pages, @customers = paginate :customers, {:per_page =><br>>> 10, :include => 'tags', :conditions=>'tag_id = 3'}<br>>> end<br>>><br>>> def show<br>>> @customer =
Customer.find(params[:id])<br>>> end<br>>><br>>> def new<br>>> @customer = Customer.new<br>>> end<br>>><br>>> def create<br>>> @customer = Customer.new
(params[:customer])<br>>> if @ customer.save<br>>> flash[:notice] = 'Customer was successfully created.'<br>>> redirect_to :action => 'list'<br>>> else<br>>> render :action => 'new'
<br>>> end<br>>> end<br>>><br>>> def edit<br>>> @customer = Customer.find(params[:id])<br>>> end<br>>><br>>> def update<br>>> @customer = Customer.find
(params[:id])<br>>> if @customer.update_attributes(params[:customer])<br>>> flash[:notice] = 'Customer was successfully updated.'<br>>> redirect_to :action => 'show', :id => @customer
<br>>> else<br>>> render :action => 'edit'<br>>> end<br>>> end<br>>><br>>> def destroy<br>>> Customer.find(params[:id]).destroy<br>>> redirect_to :action => 'list'
<br>>> 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>>> Session ID: ee0f5f8afb0b2740be5f9463b8962e0b<br>>> Parameters: {"action"=>"list", "controller"=>"customers"}
<br>>> Customer Count (0.000700) 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>>> Customer Columns (0.000248) SHOW FIELDS FROM customers<br>>> Tag Columns (
0.000186) SHOW FIELDS FROM tags<br>>> 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) LIMIT<br>>> 0, 10):<br>>> /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>>> /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>>> /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>>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0
/lib/<br>>> active_record/connection_adapters/mysql_adapter.rb:176:in<br>>> `select_all'<br>>> /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>>> /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>>> /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>>> /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>>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/<br>>> active_record/associations.rb:1094:in `select_all_rows'<br>>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-
1.14.0/lib/<br>>> active_record/associations.rb:960:in `find_with_associations'<br>>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/<br>>> active_record/base.rb:923:in `find_every'<br>>> /usr/local/lib/ruby/gems/1.8/gems/activerecord-
1.14.0/lib/<br>>> active_record/base.rb:381:in `find'<br>>> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/<br>>> action_controller/pagination.rb:182:in<br>>> `find_collection_for_pagination'
<br>>> /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>>> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0
/lib/<br>>> action_controller/pagination.rb:129:in `paginate'<br>>> /app/controllers/customers_controller.rb:12:in `list'<br>>> /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>>> /usr/local/lib/ruby/gems/1.8/gems/actionpack- 1.12.0/lib/<br>>> action_controller/filters.rb:355:in<br>>> `perform_action_without_benchmark'<br>>> /usr/local/lib/ruby/gems/1.8/gems/actionpack-
1.12.0/lib/<br>>> action_controller/benchmarking.rb:69:in<br>>> `perform_action_without_rescue'<br>>> /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'<br>>> /usr/local/lib/ruby/gems/1.8/gems/actionpack-
1.12.0/lib/<br>>> action_controller/benchmarking.rb:69:in<br>>> `perform_action_without_rescue'<br>>> /usr/local/lib/ruby/gems/1.8/gems/actionpack- 1.12.0/lib/<br>>> action_controller/rescue.rb:82:in `perform_action'
<br>>> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/<br>>> action_controller/base.rb:379:in `process_without_filters'<br>>> /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>>> /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/<br>>> action_controller/session_management.rb:117:in `process'
<br>>> /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/dispatcher.rb:<br>>> 38:in `dispatch'<br>>> /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/<br>>> fcgi_handler.rb:150:in `process_request'
<br>>> /usr/local/lib/ruby/gems/1.8/gems/rails- 1.1.0/lib/<br>>> fcgi_handler.rb:54:in `process!'<br>>> /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:600:in `each_cgi'<br>>> /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi'
<br>>> /usr/local/lib/ruby/gems/1.8/gems/rails- 1.1.0/lib/<br>>> fcgi_handler.rb:53:in `process!'<br>>> /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/<br>>> fcgi_handler.rb:23:in `process!'
<br>>> /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>>> _______________________________________________<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>><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><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>