
So Brad, Mark, and I are sitting at work watching the new Rails Routes Peepcode and someone asked “What happens if you do ‘map.resources :page’ vs. ‘map.resources :pages’”. Be default, we thought Rails would crap out when you did that because page_path would expect an :id, and how would you get the collection (eg. pages_path wouldn’t exist).
After putting map.resources :page into routes.rb and running rake routes, we quickly learned that this has been accounted for with object_index_path… See below:

And further proven in console:

I’m not really sure when this change was implemented, or if it was maybe there all along, but that’s an interesting little tidbit. If you ever need a resource to be name singularly, you’re fine, just use page_index_path for the collection, and then page_path(:id) for the member.
Not bad, Rails Team.
P.S. Brad is the one that caught this in the output from rake routes. Good eye, man!
Ok, as a little disclaimer, I haven’t used a *ton* of action caching, so this may be old news to everyone out there, but just in case there’s someone out there wondering about where the cached fragments go, here’s what I dug out of the Rails source earlier today:
Configuration examples (MemoryStore is the default):
ActionController::Base.cache_store = :memory_store
ActionController::Base.cache_store = :file_store, "/path/to/cache/directory"
ActionController::Base.cache_store = :drb_store, "druby://localhost:9192"
ActionController::Base.cache_store = :mem_cache_store, "localhost"
ActionController::Base.cache_store = MyOwnStore.new("parameter")
I found that little helpful bit of info here: http://dev.rubyonrails.org/changeset/8393
For those of you who follow DHH on Twitter it will come as no surprise that the Rails 2.1 Release Candidate is out.
For those of you who don’t… the Rails 2.1 Release Candidate is out.
Get it by running this command:
sudo gem install rails --source http://gems.rubyonrails.com/
Check to see if it worked by running:
rails -v
And you should see:
Rails 2.0.991
So I got bit by the git bug. Hmm… nice sentence. Anyway… last night I was at the OC Ruby Group and Rob Olson made an excellent presentation on git. And seeing as how Rails, Merb, RSpec and numerous other projects that affect me have moved to GitHub, I figured I may as well learn it. So, my first step was to migrate a personal project I’ve been working on from Subversion over to Git. Thanks to google, and Jon Maddox it couldn’t have been easier.
Go see for yourself: http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/.