What do people prefer for ensuring that ActiveRecord connections get freed?
#activerecord #sidekiq
What do people prefer for ensuring that ActiveRecord connections get freed?
#activerecord #sidekiq
ActiveRecord's callback hell is worse than JavaScript's callback hell.
Prove me wrong.
Lazy ActiveRecord: can you use query class-methods defined in another model from within where() statements when doing deep joins() from a different model?
class Bar < ActiveRecord::Base
def self.with_baz(value)
...
end
end
class Thing < ActiveRecord::Base
def self.bars_with_baz(value)
joins(foo: [:bar]).where(
foo: {
bar: {with_baz: value}
}
)
end
end
When validating the uniqueness of a belongs_to, is it really necessary to use the foreign-key name (ex: :foo_id)? Or will the association name suffice? I'm wondering if `validates :foo_id, uniqueness: ...` is different or equivalent to `validates :foo, uniqueness: ...`, or maybe some legacy cargo culting due to old bugs?
#activerecord
What are people's opinions on setting the column length for string enum columns in migrations?
#activerecord #rails
What is the preferred way to setup CI to test ActiveRecord migrations (as well as any raw SQL queries) against sqlite3, postgres, mysql? Apparently I have to setup a "service container" for postgres. How do I shoehorn it into the CI matrix?
https://gist.github.com/RizkyRajitha/ca945c55ab09bcc2c7c150b2fed7db13
#activerecord
okay, it's not just me... the #mongoose #middleware is just really poorly designed. Really frustrating for those of us coming from an #activeRecord world where things are just a lot more mature.
Just wish I hadn't lost the hours I just spent banging my head against this. But at least I know now to just not attempt anything non-trivial via middleware.
How do you validate that at least one of three (or more) ActiveRecord belongs_to associations are set? Every example I can find mentions only two belongs_to associations.
#activerecord
Is adding `after { ActiveRecord::Base.clear_active_connections! }` to a non-Rails app that uses ActiveRecord still necessary in order to prevent those pesky 5 second timeout exceptions after so many requests?
#sinatra #activerecord
Here’s what I want. A package for persisting data that uses a #SwiftUI-style DSL to define models and migrations, has simple concurrency, uses the #ActiveRecord pattern, and steals anything #Rails gets right.
I don’t know if I have the skills to pull that off by myself, or how much Swift would fight you in trying to achieve this, but I think it would be fantastic and a better developer experience than #CoreData.
Please don’t reply to tell me about existing persistence frameworks.
Suppose you want a test in #Rails #ActiveRecord that says "make sure this scope has applied".
How about using `#annotate` in the scope definition, then testing the generated SQL for the presence of the annotation text?