.ruby-version & rbenv
- so rbenv now does support a ruby version file but doesn’t support fuzzy matching. See.
Multipart = true
- HTML forms provide two methods of encoding. The default is application/x-www-form-urlencoded, which is more or less the same as a query string on the end of the URL. The other, multipart/form-data, is a more complicated encoding but one which allows entire files to be included in the data. via
- had trouble with validation requirements built into the
validatablemodule and configuring it to allow a user to edit their profile without requiring a password, which involved destroying the session because the salted password had changed. I ended up ripping it out and going with a
validates_presence_of :password, :on => :createinstead.
- I had attempted this, but it seemed like a lot of work.
Factory Girl Associations
From the docs it’s possible to set up associations within factories. If the factory name is the same as the association name, the factory name can be left out.
1 2 3 4
To not save the associated object, specify strategy:
:build in the factory:
1 2 3 4
This does not work; causes author_id to be nil
1 2 3
Staging assets broken
Racked my brain (and everyone elses) over this one… It ended up I hadn’t added the
rails_12factor gem to staging though I had added that environment.
- had a feature that pulls events once they have passed. Heroku’s time zone is by default set to
UTC. So I did two things:
Had an issue expiring the fragment cache. The issue was that when you cache the fragment in your view, a cache digest is being added to the cache key (views/all_available_releases/41cb0a928326986f35f41c52bb3d8352), but
expire_fragmentis not using the digest (views/all_available_releases).
skip_digest: trueto the cache call in the view it should prevent the digest from being used.
1 2 3 4 5 6 7 8
- Cache digests are only intended to be used with automatic cache expiration. If you need to manually expire cache keys then you can’t use cache digests.
- Saved by stackoverflow