PiRSquared17 / activescaffold

Automatically exported from code.google.com/p/activescaffold
MIT License
0 stars 0 forks source link

using quote_column_name(@table) fails #747

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am creating this ticket so that I can submit a very simple fix.  We have an 
app that uses 
ActiveScaffold and it's dieing due to improper quoting of a table name.  
Specifically, 
@active_record_class.connection.quote_column_name(@table) is being used where 
@active_record_class.connection.quote_table_name(@table) should be used.

What steps will reproduce the problem?
1. Use more than one database with mysql
2. list something
3.

What is the expected output? What do you see instead?

The app dies, because MySQL expects the table name to be quoted as
`database`.`table`
and instead we get
`database.table`

What version (or revision) of the product are you using?
http://github.com/activescaffold/active_scaffold/tree/rails-2.3

If this bug causes an exception, please paste at least the first 20 lines below.

Mysql::Error: Unknown column 'hotel_scraper.reservation_engines.display_name' 
in 'order clause': 
SELECT `hotel_scraper`.`reservation_engines`.* FROM 
`hotel_scraper`.`reservation_engines`   
ORDER BY `hotel_scraper.reservation_engines`.`display_name` ASC LIMIT 0, 500
RAILS_ROOT: /Users/ctm/j/hotel_scraper

Application Trace | Framework Trace | Full Trace
/Users/ctm/j/hotel_scraper/vendor/rails/activerecord/lib/active_record/connectio
n_adapters/ab
stract_adapter.rb:219:in `log'
/Users/ctm/j/hotel_scraper/vendor/rails/activerecord/lib/active_record/connectio
n_adapters/m
ysql_adapter.rb:319:in `execute'
/Users/ctm/j/hotel_scraper/vendor/rails/activerecord/lib/active_record/connectio
n_adapters/m
ysql_adapter.rb:604:in `select'
/Users/ctm/j/hotel_scraper/vendor/rails/activerecord/lib/active_record/connectio
n_adapters/ab
stract/database_statements.rb:7:in `select_all_without_query_cache'
/Users/ctm/j/hotel_scraper/vendor/rails/activerecord/lib/active_record/connectio
n_adapters/ab
stract/query_cache.rb:62:in `select_all'
/Users/ctm/j/hotel_scraper/vendor/plugins/data_fabric/lib/data_fabric/ar22.rb:77
:in `send'
/Users/ctm/j/hotel_scraper/vendor/plugins/data_fabric/lib/data_fabric/ar22.rb:77
:in 
`method_missing'
/Users/ctm/j/hotel_scraper/vendor/rails/activerecord/lib/active_record/base.rb:6
61:in 
`find_by_sql'
/Users/ctm/j/hotel_scraper/vendor/rails/activerecord/lib/active_record/base.rb:1
548:in 
`find_every'
/Users/ctm/j/hotel_scraper/vendor/rails/activerecord/lib/active_record/base.rb:6
15:in `find'
/Users/ctm/j/hotel_scraper/vendor/rails/activerecord/lib/active_record/base.rb:6
35:in `all'
/Users/ctm/j/hotel_scraper/vendor/plugins/active_scaffold/lib/active_scaffold/fi
nder.rb:221:in 
`find_page'
/Users/ctm/j/hotel_scraper/vendor/plugins/active_scaffold/lib/paginator.rb:66:in
 `call'
/Users/ctm/j/hotel_scraper/vendor/plugins/active_scaffold/lib/paginator.rb:66:in
 `page'
/Users/ctm/j/hotel_scraper/vendor/plugins/active_scaffold/lib/paginator.rb:93:in
 `call'
/Users/ctm/j/hotel_scraper/vendor/plugins/active_scaffold/lib/paginator.rb:93:in
 `items'
/Users/ctm/j/hotel_scraper/vendor/plugins/active_scaffold/lib/active_scaffold/ac
tions/list.rb:61
:in `do_list'
/Users/ctm/j/hotel_scraper/vendor/plugins/active_scaffold/lib/active_scaffold/ac
tions/list.rb:22
:in `list'
/Users/ctm/j/hotel_scraper/vendor/plugins/active_scaffold/lib/active_scaffold/ac
tions/list.rb:8:i
n `index'
/Users/ctm/j/hotel_scraper/vendor/rails/actionpack/lib/action_controller/base.rb
:1331:in 
`send'
/Users/ctm/j/hotel_scraper/vendor/rails/actionpack/lib/action_controller/base.rb
:1331:in 
`perform_action_without_filters'
/Users/ctm/j/hotel_scraper/vendor/rails/actionpack/lib/action_controller/filters
.rb:617:in 
`call_filters'
/Users/ctm/j/hotel_scraper/vendor/rails/actionpack/lib/action_controller/filters
.rb:638:in 
`run_before_filters'

Original issue reported on code.google.com by c...@devctm.com on 22 May 2010 at 2:19

GoogleCodeExporter commented 9 years ago
I've made the trivial change and submitted a pull request.

http://github.com/ctm/active_scaffold/tree/fix_747

Original comment by c...@devctm.com on 22 May 2010 at 2:31

GoogleCodeExporter commented 9 years ago
Fixed in a37aad

Original comment by sergio.c...@gmail.com on 24 May 2010 at 7:41