tkadauke/motion-resource — pull request #14 by nathanstitt (2013-07-07 16:30:02+00:00)
Title: belongs_to accept :class_name as well

Extend belongs_to to use same syntax as has_many.

In my codebase, I've got several objects that belong_to a common Address class, but refer to it as billing_address, shipping_address, etc.

As you've probably observed, this will be a breaking change for everyone who's using the params option to belongs_to. I'm not sure how much use the params parameter has seen though.

To smooth this, I could put a type check on options to see if it's a Proc, and if so, populate the options[:params] with it. Something like:
```ruby
def belongs_to(name, options={} )
if options.is_a?(Proc)
options = {
:params => options
:class_name => name.to_s.classify
}
else
// code as it is in patch
```

You could leave that check in for a few releases then take it out eventually