-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration from the Squeel Community #20
Comments
Example one:
|
Hi @Schwad, this is a great idea. I actually added a Squeel compatibility mode for this exact reason, which should make the migration a little bit easier. Enabling compatibility mode will override Active Record's query methods, allowing I do, however, recommend avoiding compatibility mode. Because it overrides methods in Active Record, it is more likely to break with future Active Record releases. Stability is one of my top goals for this project. I like the idea of this thread, and I'd appreciate it if we could get a list of the changes you had to make as you migrated. I'll also put together a list of all of the differences I'm aware of. |
Glad to hear it @rzane , hopefully as I go forward I can be a bit of use, that way future folks coming to this gem can do the switch in minutes :)
|
I've started a wiki page here: https://github.com/rzane/baby_squeel/wiki/Migrating-from-Squeel Contributions welcome! |
This is really handy! Thanks!!! |
I'm not sure how to make contributions to someone else's wiki, a quick search in this wasn't clear. On BabySqueel.configure do |config|
config.enable_compatibility!
end To match your gem. I do not intend to rely on |
Oh, nice catch! Thanks. |
Okay, so here's a command working on someone else's machine but not mine with Baby Squeel, let me know what you think or what configurations I need to do.
That's an example. Essentially for when I want to find customers with no custom_fields, when there's a has_many relationship to the fields. Similarly with Here is the error that I get on my machine (with object names edited to match example above):
I'm sorry if this is related to something else in my Rails 5 upgrade - just wanted your thoughts. |
The example you've provided above isn't using Baby Squeel at all. However, the problem is that you need to tell Active Record that you're referencing that table (to kick off a join). Try this: Customer.includes(:custom_fields).where("custom_fields.customer_id IS NULL").references(:custom_fields) |
Thanks @rzane, perhaps I should have articulated that it wasn't a direct use of Baby Squeel, but me trying to use logic that was a bit closer to SQL to see why I was getting that error, I guess since Baby Squeel didn't monkey patch activerecord at all, it won't have any possibility of a knock-on effect when I'm using non BabySqueel style queries! Thanks for the prompt response and feedback! |
No problem. And yes, because there are no monkey patches, Baby Squeel will not affect any of Active Record's bevahior. |
I am here after going through this thread: activerecord-hackery/squeel#412
I'm sure I'm not the only one maintaining an app that relied on
Squeel
for a long time and is now trying to upgrade to Rails 5, seeingBaby Squeel
as the only option going forward. Would it be possible to get a chunk in the README to help us flag up what changes we will need to make to an application to switch from Squeel to Baby Squeel integration?Happy to have a dialogue here on this, hope my issue makes sense. Thanks!
The text was updated successfully, but these errors were encountered: