On Sep 15, 4:26 pm, Aldric Giacomoni <rails-mailing-l...@andreas-
s.net> wrote:
> Frederick Cheung wrote:
> > If they are two separate databases then you'll probably have to do
> > this mostly in ruby (ie grab a record from one table then see if it
> > exists in the other table). If both tables were in the same database
> > you could probably write this as a join, but not if the tables are not
> > in the same database
>
> > Fred
>
> In short - there's no clean way in Rails to do this? It's a pure SQL
> solution?
> How do I execute pure SQL from within Rails? Do I have to use DBI?
>
YourModel.connection.execute
But you can't do it with pure sql if the tables are in different
databases. Of course the ultimate solution to finding matches between
two tables like this is to not need to in the first place - organise
your data so that it isn't duplicated.
Fred
> I can definitely put both tables in the same database; my original
> choice of making it two separate databases did little besides teach me
> how to connect to more than one database with Rails ;-) This is all read
> only data anyway.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---