voxdolo/decent_exposure — pull request #34 by coffeencoke (2012-01-03 21:31:31+00:00)
Title: Make the default exposure send an empty hash when the resource params are nil

If the resource param is nil, it sends to the initialize method as `nil`. Because of this, every initialize method must handle 3 types of values: default value ({}), nil value, and a hash with given values.

We are not using ActiveRecord, Mongoid, or any other ORM. For each model we use decent exposure with, we have to do the following:

```ruby
def initialize(hash={})
hash ||= {} # do not want to do this!
self.some_attribute = hash[:some_attribute]
end
```