Upgrading from Rails 3.2 to Rails 4.0 is not a trivial task. Sure, there is a guide, but when you upgrade you'll probably be upgrading a lot of your gems, maybe your jQuery and jQuery-UI versions and then there are all the undocumented unintentional changes that can cause you grief. If you've got a good test suite (you have one right?) you'll catch a lot of these, but some will leave you scratching your head. This one tripped me up for a while: we had a very simple scope stop working in Rails 4.
The scope model below works in Rails 3.2, but fails in Rails 4 when used with an association:
Tuesday, March 25, 2014
Friday, March 14, 2014
Rails: updating an association through nested attributes does not touch the owner
I was a little surprised to discover that when you update an association through nested attributes, it won't touch the parent record. It makes sense when you consider that Rails is optimizing by not writing records that have not changed, but if were using updated_at on the model for caching you may be surprised.
For instance:
For instance:
Wednesday, March 12, 2014
Caching user records when using Authlogic
Today, I ran across another form of this issue with Authlogic. In short, every request in a Rails application using Authlogic with a User model that includes a last_request_at column will cause the updated_at column to change. This can break caching that is based on the last time a user was updated.
Labels:
authlogic,
cache-control,
caching,
controllers,
etags,
rails
Subscribe to:
Posts (Atom)