Skip to content

Compatibility Mode

Ray Zane edited this page Aug 5, 2016 · 4 revisions

Baby Squeel offers a compatibility mode to decrease the initial effort of migrating to Baby Squeel.

To enable it, go ahead and throw this in an initializer:

# config/initializers/baby_squeel.rb
BabySqueel.configure do |config|
  config.enable_compatibility!
end

What does it do?

  • It monkey patches Active Record's query methods, so you can continue giving DSL blocks to select, order, joins, group, and having. (:monkey: :gun:)
  • It allows you to continue using backticks for SQL literals.
  • It allows you to use #my to access methods and instance variables within DSL blocks without arity.

Should you use it?

No. Seriously, try to avoid it. The features included by Baby Squeel's compatibility mode are all features that I don't think you should use, because they are either problematic or not programmer friendly.

I want to make your migration to Baby Squeel easy, so I've added this mode. But I hope for your sanity and mine that you don't use compatibility mode. Or, that you use it with every intention of refactoring soon.

All compatibility mode features have better alternatives in Baby Squeel. For a complete overview, see Migrating from Squeel.

Clone this wiki locally