Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's possible to do that in AdequateRecord, but I've purposely left the mechanism undocumented because the API is not stable. You can do something like this:

  statement = undocumented_method_call { |params|
    Article.where(xxx: params[:xxx])
  }
  statement.execute xxx: "some value"
https://github.com/rails/rails/blob/e5e440f477a0b5e06b008ee7...

The trick is that the cache only supports caching ActiveRecord::Relation objects, and not everyone knows which calls will return a Relation object. For now, I want to hide this API and make it as "automatic" as possible so that people don't have to change app code, but still get performance boosts.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: