On Apr 16, 12:24 pm, Brian Takita <[email protected]> wrote:
> Hello, I'm using Friendly in my Rails application. Currently there is
> one db connection for ActiveRecord and one db connection for Sequel.
>
> I would like my Friendly objects to play nice with my other AR
> objects, specifically when dealing with transactions.
>
> Would it be possible to use the same connection object as ActiveRecord?
> Are there any bridges or apis out there?

I think this is a bad idea, but it's probably doable:

  connection =
ActiveRecord::Base.connection.instance_variable_get(:@connection)
  DB = Sequel.connect('...')
  DB.meta_def(:connect){connection}

This isn't thread safe of course, and it probably has numerous other
problems, but if you want it bad, you get it bad.

Honestly, just use separate connections for Sequel and AR.  You'll
have fewer problems that way.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-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/sequel-talk?hl=en.

Reply via email to