Date#change
Date now has #change and works just like Time#change. So now we can do:
next_bill_date = Date.today.change( :month => Date.today.month + 1, :day => 15)
All controller names pluralized
map.resource will now map to a pluralized controller name by default:
map.resource :account # now maps to:
AccountsController < ApplicationController
Where this makes even more sense to me is in this situation which I brought up in a post on the rubyonrails-core mailing list . Let’s say I have products which each has_one manufacturer. I want to be able to control those manufacturers both within the context of their association with the products and separately on their own. The way it used to be:
map.resources :products, :has_one => :manufacturer #=> ManufacturerController
map.resources :manufacturers #=> ManufacturersController
The first mapping would look for a ManufacturerController because :has_one generates a singleton resource. But the second mapping would look for a ManufacturersController. Regardless of the context, I’m probably going to control my manufacturers resource the same way. So now all controllers are by default plural, whether its coming from map:resource, map.resources, :has_one, or :has_many.
map.resources :products, :has_one => :manufacturer #=> ManufacturersController
map.resources :manufacturers #=> ManufacturersController
with_scope and with_exclusive_scope are now protected
DHH has followed through on his promise to make with_scope a protected method and with_exclusive_scope has come along for the ride.
