remiprev/her — pull request #285 by balvig (2014-09-17 17:12:31+00:00)
Title: Allow "super" to be called within overridden association methods

## Use case

It is sometimes useful to be able to extend the association methods that `has_many` et al dynamically generate. For example interacting with a users API that returns a `comment_count` cache, we can save an extra roundtrip to the API by shutting down requests for comments if the counter is 0. Simplified example:

```ruby
class User
include Her::Model
has_many :comments

def comments
return [] if comment_count <= 0
super
end
```

## The issue

Currently, defining a `comments` method will completely override the dynamically created version and when calling `super` raise the exception `no superclass method 'comments'`.

## The fix

Using [Avdi Grimm](https://gist.github.com/avdi/6123055) and [Henrik Nyh's](http://thepugautomatic.com/2013/07/dsom/) pattern of including the methods as a module allows us to override the dynamically generated methods and call super from within them, similar to how ActiveRecord works.