On Miércoles, 15 de Septiembre de 2010 21:48:07 Iñaki Baz Castillo escribió:
> Hi, until yesterday (2010-09-14) I could use active_scaffold with two
> databases by doing this hack:
>
> ----------- database.yml --------------
> production:
>   adapter: mysql
>   database: db_1
>   username: xxxxxxxx
>   password: xxxxxxxx
>   host: xxxxxxxxxx
>   db_2:
>     adapter: mysql
>     database: db_2
>     username: xxxxxx
>     password: xxxxxx
>     host: xxxxxxxx
> -----------------------------------------------
>
>
> --------- models/item.rb ------------
> class Item < ActiveRecord::Base
>   establish_connection configurations[RAILS_ENV]["db_2"]
>   def self.table_name() "db_2.items" end
> end
> ---------------------------------------------
>
>
> Note that I use "db_2.items" as table name. This is a workaround as
> active_scaffold (or perhaps AR) assumes that the main database (db_1)
> is always used.
>
> So this worked until yesterday, but today I've upgraded
> active_scaffold (for rails 2.3.X) and get this error:
>
> ------------------------------------------------
> Mysql::Error: Unknown column 'db_2.items.Id_Cliente' in 'order
> clause': SELECT `db_2`.`items`.* FROM `db_2`.`items`  ORDER BY
> `db_2.items`.`Id_Cliente` ASC LIMIT 0, 20
> ------------------------------------------------
>
> The problem occurs due to `db_2.items`.`Id_Cliente` . It should be
> `db_2`.`items`.`Id_Cliente`. And this is *exactly* what I got with the
> previous active_scaffold version:
>
> ----------------------------------
> SELECT `db_2`.`items`.* FROM `db_2`.`items` ORDER BY
> `db_2`.`items`.`Id_Cliente` ASC LIMIT 0, 20
> ----------------------------------
>
>
> I've tested it in both cases with Rails 2.3.9 and with a previous
> version of active_scaffold and the version of today.

master branch had a fix for multiple databases which rails-2.3 didn't have. I 
have backported it now.

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to