applicake/doorkeeper — pull request #181 by felipeelias (2012-12-16 00:12:30+00:00)
Title: Extract application (aka client) to a module

Big change.

The `Application` model is now responsibility of the rails app. In a comparison with devise, this will be very similar to what the `User` model is.

This will affect most of what the current gem does and will break some stuff when upgrading.

The advantage is that there will be no need of monkey patching if you need to customize what are the model fields of `Application` which before was a bit of pain.

The generators were split into two. One for default models and the other one to generate the "client" model:

rails generate active_record:doorkeeper_tables
rails generate active_record:doorkeeper_client MODEL

Similar generators were created for `Mongoid` and `MongoMapper`

Within the client, the generator will add `doorkeeper_client!` method. For now it simply extend the current class into doorkeeper client's behaviour. This method will allow customization of which modules are integrated:

```ruby
class Client < ActiveRecord::Base
# future wise, this method will allow module customization
doorkeeper_client!

attr_accessible :name, :redirect_uri
end
```

**NOTE:** Application ownership was removed. It is much more simpler to define what is the relationship in your own model than extending a module that cannot be customizable.

**NOTE 2:** If you generated the views, it is required to re-generate them since they had to be adapted to this feature.