#51

New

Bug in pluralize for legacy table

Reported by ComputerMage on Ajax Scaffold · 27/09/2006 20:05:18

Assigned to:
rrwhite
Priority:
Normal
Status:
New
Category:
None
Version:
3.1.9

Hi there!

I wanted to share the problem. It looks like pluralize doesn’t work with legacy tables.

I think that the good idea is to depend not in pluralize but on actual data from derived class.

class Chart < ActiveRecord::Base
set_table_name ‘chart’

establish_connection( :adapter => “postgresql” , :host => “localhost” , :database => “db” , :username => “user” , :password => “secretPassw0rd” ) belongs_to :gifi, :class_name => ‘GIFI’, :foreign_key => ‘gifi_accno’ has_many :transactions, :class_name => ‘AccountTransaction’, :order => ‘transdate’

end

Here is the error.

ActiveRecord::StatementInvalid in ChartController#table

PGError: ERROR: missing FROM-clause entry for table “charts”
: SELECT * FROM chart ORDER BY charts.id asc LIMIT 25 OFFSET 0

RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace

/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract_adapter.rb:120:in `log’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/postgresql_adapter.rb:148:in `execute’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/postgresql_adapter.rb:361:in `select’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/postgresql_adapter.rb:129:in `select_all’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:390:in `find_by_sql’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:924:in `find_every’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:381:in `find’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/pagination.rb:182:in `find_collection_for_pagination’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:388:in `page_and_sort_charts_collection’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:204:in `table_setup’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:178:in `table’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `perform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `measure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform_action’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:71:in `process_with_components’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:137:in `component_response’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:108:in `render_component_as_string’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:107:in `component_logging’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:107:in `render_component_as_string’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:44:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:44:in `render_component’
#{RAILS_ROOT}/app/views/ajax_scaffold/list.rhtml:1:in `_run_rhtml_ajax_scaffold_list’

/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract_adapter.rb:120:in `log’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/postgresql_adapter.rb:148:in `execute’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/postgresql_adapter.rb:361:in `select’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/postgresql_adapter.rb:129:in `select_all’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:390:in `find_by_sql’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:924:in `find_every’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:381:in `find’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/pagination.rb:182:in `find_collection_for_pagination’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:388:in `page_and_sort_charts_collection’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:204:in `table_setup’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:178:in `table’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `perform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `measure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform_action’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:71:in `process_with_components’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:137:in `component_response’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:108:in `render_component_as_string’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:107:in `component_logging’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:107:in `render_component_as_string’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:44:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:44:in `render_component’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in `compile_and_render_template’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in `render_template’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in `render_file’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:726:in `render_file’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:664:in `render_with_no_layout’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/layout.rb:242:in `render_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `render’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `measure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `render’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:418:in `render_template’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:228:in `list’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `perform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `measure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform_action’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in `dispatch’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in `handle_dispatch’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:81:in `service’
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service’
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run’
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread’
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start’
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread’
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start’
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each’
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start’
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start’
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:67:in `dispatch’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:59
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require’
script/server:3

/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract_adapter.rb:120:in `log’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/postgresql_adapter.rb:148:in `execute’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/postgresql_adapter.rb:361:in `select’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/postgresql_adapter.rb:129:in `select_all’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:390:in `find_by_sql’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:924:in `find_every’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:381:in `find’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/pagination.rb:182:in `find_collection_for_pagination’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:388:in `page_and_sort_charts_collection’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:204:in `table_setup’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:178:in `table’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `perform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `measure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform_action’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:71:in `process_with_components’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:137:in `component_response’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:108:in `render_component_as_string’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:107:in `component_logging’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:107:in `render_component_as_string’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:44:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/components.rb:44:in `render_component’
#{RAILS_ROOT}/app/views/ajax_scaffold/list.rhtml:1:in `run_rhtml_ajax_scaffold_list’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in `compile_and_render_template’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in `render_template’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in `render_file’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:726:in `render_file’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:664:in `render_with_no_layout’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/layout.rb:242:in `render_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `render’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `measure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:53:in `render’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:418:in `render_template’
vendor/plugins/ajaxscaffoldp/lib/ajax_scaffold_plugin.rb:228:in `list’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in `perform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `measure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in `perform_action’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in `process_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in `process_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in `process’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in `dispatch’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in `handle_dispatch’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:81:in `service’
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service’
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run’
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread’
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start’
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread’
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start’
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each’
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start’
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start’
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:67:in `dispatch’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:59
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active
support/dependencies.rb:147:in `require’
script/server:3

Request

Parameters: {"id"=>nil, “scaffold_id”=>"chart", “sort”=>nil, “sort_direction”=>"asc", “page”=>1}

Show session dump


chart:
:sort:
:page: 1
:sort_direction: asc
flash: !ruby/hash:ActionController::Flash::FlashHash {}

Response
Headers: {"cookie"=>[], “Cache-Control”=>"no-cache"}

Attachments Upload

No attachment has been uploaded, yet.


Loading comments...