afair / postgresql_cursor

ActiveRecord PostgreSQL Adapter extension for using a cursor to return a large result set
MIT License
599 stars 48 forks source link

Use ActiveSupport.on_load hook for defining anything on top of AR #43

Closed amatsuda closed 4 years ago

amatsuda commented 5 years ago

Another reason that was causing problems like #41 is that this gem touches ActiveRecord::Base from the toplevel. This should better be delayed until the application defines a model and loads AR::Base, and for that purpose, Rails has ActiveSupport.on_load mechanism.

This simple hook is indeed independent on Rails (Raities) since it's implemented in Active Support and triggered within AR::Base class, so it should work with non-Rails apps.

johvet commented 5 years ago

👍