You have to be a little careful with this, for sure, however it is not
difficult as long as you keep in mind which models belong where.
This is a decent article on how to do this:
http://schf.uc.org/articles/2006/12/06/multiple-concurrent-database-connections-with-activerecord
Do note that AR classes which redefine database connections can be
subclassed and keep the super-class''s db connection. Thus:
class MySQLConn < ActiveRecord::Base
establish_connection ...
end
class SQLServerConn < ActiveRecord::Base
establish_connection ...
end
Then:
class Model1 < MySQLConn
... does stuff to mysql
end
class Model2 < SQLServerConn
... does stuff to sqlserver
end
You''ll have to go searching around and give some thought into dealing
with
test fixtures with this. There are a few articles around though as I
haven''t
done that, I''m not sure the best way.
Jason
On 1/15/07, Diego <dbarros-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
>
> I was wondering, how easy is it to develop an application to support
> different database back-ends? For example, I am looking to develop an
> app to support MySQL and SQLServer. One developer working in OS X
> against MySql, the other in Windows against SQLServer. Are there
> problems which may be encountered or does Rails handle all and it
"just
> works"?
>
> Cheers,
> Diego
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---