Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
ActionCable Postgres adapter is ActiveRecord-specific #27214
Steps to reproduce
Ideally, this would support the most popular Postgres ORMs out of the box. Or at least the docs should mention that this only works with AR.
Exception trying to autoload ActiveRecord
Rails version: 184.108.40.206
Ruby version: 2.3.3
It was very easy to fork the Postgres ActionCable subscription adapter to work with Sequel. I only had to alter the
I'm not sure whether the right approach is to try to support this out-of-the-box, or at least to document that the adapter is AR-specific. Thoughts?
As a user I'd certainly prefer not to have to maintain a fork of the subscription adapter. But I can certainly see the argument for this not being Rails' problem. I suppose I really only need to monkey-patch or refine that one method, though, so not too bad either way.
That is a good point. I don't see why this code is using Active Record at all, it should not, even more that actioncable doesn't depend on activerecord and active record base is not being required in that file.
In my opinion we should use the pg connection directly.
@rafaelfranca my guess is it's because it's piggybacking on the AR database config logic. An alternative approach to supporting any ORM is to have a config setting that lets me specify how to get a new PG connection, defaulting to the AR method used currently.
I did notice the lack of a require at the top which is maybe a separate but related issue?
I prefer to use the connection directly over supporting different ORM. There is no need for a ORM in actioncable.
We can't add the require without changing the dependencies of actioncable to add activerecord, so I prefer that we solve this issue removing any orm specific code.