mcmire + activerecord   27

Crazy, Heretical, and Awesome: The Way I Write Rails Apps | James on Software
Stuffing code in model callbacks just makes things hard to test. Alternative: use a factory class that glues the main model and a dependent model together, and use that factory class from now on. That way you can just mock out the class in your tests.
rails  activerecord  srp  dependencyinjection 
march 2010 by mcmire
xgamerx's conditions_fu at master — GitHub
Datamapper-style query building using ActiveRecord, w00t!
rails  activerecord  querybuilding  datamapper 
september 2008 by mcmire
Simpler Piggy Backing
Using "piggy backing" to speed up SQL queries that involve joins, instead of relying on eager loading
rails  optimization  activerecord  plugin 
august 2008 by mcmire
cfis : :select meets :include (or a pitch for rparsec)
Possibly a way to use :select with :include using rparsec...
activerecord  query  parser 
august 2008 by mcmire
ar-enumerable README
Rails plugin that uses cursors to iterate through the results of a query X records at a time, instead of relying on LIMIT and OFFSET, which may be much slower
activerecord  cursor  iterator  rails 
july 2008 by mcmire
nick - HasFinder -- It's Now Easier than ever to create complex, re-usable SQL queries
YES!! THIS IS WHAT I'VE BEEN WANTING!!! scope_out + association extensions = filters!! And it looks like it'll be in the next release of Rails, too!
activerecord  plugin  ruby  rails  filter 
march 2008 by mcmire
Extending ActiveRecord
ar-extensions Rails plugin makes it easier to do things like "WHERE x BETWEEN ? AND ?" and "WHERE y LIKE '%blah%'" without reverting to find_by_sql
ruby  rails  plugin  activerecord  query  building 
march 2008 by mcmire : Ruby's ActiveRecord Makes Dropping to Raw SQL a Royal Pain (Probably on Purpose)
so you don't have to say ActiveRecord::Base.send(:sanitize_sql, blah) every time you want to just to fucking sanitize SQL...
ruby  rails  sql  activerecord  hack 
march 2008 by mcmire
ActiveRecord: the Visual Basic of Object Relational Mappers at Pervasive Code
ActiveRecord (like Visual Basic) makes it easy to do the easy things, and impossible to do the hard things.
ruby  rails  annoyances  opinion  blog-entry  activerecord  sql  database 
march 2008 by mcmire
with_scope with scope — err.the_blog
Ideas for using with_scope in a controller, without using with_scope in the controller.
ruby  rails  techniques  blog-entry  activerecord  scope 
february 2008 by mcmire
FixtureReplacement is a Rails plugin that provides a simple way to quickly populate your test database with model objects without having to manage multiple, brittle fixture files.
ruby  rails  plugin  activerecord  testing 
february 2008 by mcmire
Mundane Essays: Unit testing (Rails) ActiveRecord classes without a database
Interesting helper class that makes it easy to use ActiveRecord classes successfully apart from the database by stubbing attribute methods and doing some majjik.
activerecord  rails  rspec  ruby  tdd  testing 
february 2008 by mcmire
Continuous Thinking—Better Finders
Examples of using the ar-extensions plugin (Note: I think this page is old, but most of it should still be relevant)
ruby  rails  plugin  query  building  activerecord 
january 2008 by mcmire
Plugins - Validates Multiparameter Assignments - Agile Web Development
This fixes a long-standing bug in Rails concerning, well, assigning to multiparameter attributes.
ruby  rails  programming  webdev  plugin  activerecord 
november 2007 by mcmire

Copy this bookmark: