README.md in draper-3.0.0.pre1 vs README.md in draper-3.0.0

- old
+ new

@@ -105,17 +105,17 @@ * mark up attributes with a little semantic HTML, like turning a `url` field into a hyperlink ## Installation -Add Draper to your Gemfile: +As of version 3.0.0, Draper is only compatible with Rails 5 / Ruby 2.2 and later. Add Draper to your Gemfile. ```ruby -gem 'draper' + gem 'draper' ``` -And run `bundle install` within your app's directory. +After that, run `bundle install` within your app's directory. If you're upgrading from a 0.x release, the major changes are outlined [in the wiki](https://github.com/drapergem/draper/wiki/Upgrading-to-1.0). ## Writing Decorators @@ -130,10 +130,16 @@ end ``` ### Generators +To create an `ApplicationDecorator` that all generated decorators inherit from, run... + +``` +rails generate draper:install +``` + When you have Draper installed and generate a controller... ``` rails generate resource Article ``` @@ -359,10 +365,22 @@ This means that you can just replace `@article` with `article` in your views and you'll have access to an ArticleDecorator object instead. In your controller you can continue to use the `@article` instance variable to manipulate the model - for example, `@article.comments.build` to add a new blank comment for a form. +## Configuration +Draper works out the box well, but also provides a hook for you to configure its +default functionality. For example, Draper assumes you have a base `ApplicationController`. +If your base controller is named something different (e.g. `BaseController`), +you can tell Draper to use it by adding the following to an initializer: + +```ruby +Draper.configure do |config| + config.default_controller = BaseController +end +``` + ## Testing Draper supports RSpec, MiniTest::Rails, and Test::Unit, and will add the appropriate tests when you generate a decorator. @@ -475,11 +493,14 @@ ### Delegating Methods When your decorator calls `delegate_all`, any method called on the decorator not defined in the decorator itself will be delegated to the decorated object. This -is a very permissive interface. +includes calling `super` from within the decorator. A call to `super` from within +the decorator will first try to call the method on the parent decorator class. If +the method does not exist on the parent decorator class, it will then try to call +the method on the decorated `object`. This is a very permissive interface. If you want to strictly control which methods are called within views, you can choose to only delegate certain methods from the decorator to the source model: ```ruby @@ -603,13 +624,14 @@ great community of open source [contributors](https://github.com/drapergem/draper/contributors). ### Current maintainers -* Sean Linsley +* Cliff Braton (cliff.braton@gmail.com) ### Historical maintainers * Jeff Casimir (jeff@jumpstartlab.com) * Steve Klabnik (steve@jumpstartlab.com) * Vasiliy Ermolovich * Andrew Haines +* Sean Linsley