bdurand / seamless_database_pool

Add support for master/slave database clusters in ActiveRecord to improve performance.
http://rdoc.info/projects/bdurand/seamless_database_pool
MIT License
224 stars 58 forks source link

Add ActiveRecord 5 compatibility #25

Closed jkowens closed 8 years ago

jkowens commented 8 years ago

ActiveRecord 5 (RC1) now determines if prepared statements should be enabled on adapter initialization based the config settings. See: https://github.com/rails/rails/commit/8200b3ba325be07ebd579c57c7104434b0bf036e

Without this update parameter bindings are not being applied and invalid SQL queries are being executed. For example:

 ActiveRecord::StatementInvalid:
       Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1: SELECT  `mysql_test_models`.* FROM `mysql_test_models` ORDER BY `mysql_test_models`.`id` ASC LIMIT ?
jkowens commented 8 years ago

Thanks @bdurand! Can you cut a new gem?

bdurand commented 8 years ago

Done. Thanks for fixing this.

On May 30, 2016, at 2:10 PM, Jordan Owens notifications@github.com wrote:

Thanks @bdurand https://github.com/bdurand! Can you cut a new gem?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bdurand/seamless_database_pool/pull/25#issuecomment-222554980, or mute the thread https://github.com/notifications/unsubscribe/AACjP8KD_w-t3XzclgtbS8OjO94-91U8ks5qG1JhgaJpZM4Ih4J2.

jkowens commented 8 years ago

@bdurand I just discovered that this breaks compatibility with AR 3.1:

3.1.12/lib/active_record/connection_adapters/abstract_adapter.rb:45:in `initialize': wrong number of arguments (3 for 1..2) (ArgumentError)

Do you think it is ok to drop support for 3.1 at this point?