README.md in the_garage-2.0.3 vs README.md in the_garage-2.1.0

- old
+ new

@@ -24,10 +24,11 @@ In your Rails model class: ```ruby class Employee < ActiveRecord::Base include Garage::Representer + include Garage::Authorizable belongs_to :division has_many :projects property :id property :title @@ -52,9 +53,37 @@ class EmployeesController < ApplicationController include Garage::RestfulActions def require_resources @resources = Employee.all + end +end +``` + +## Create decorator for your AR models +With not small application, you may add a presentation layer to build API responses. +Define a decorator class with `Resource` suffix and define `#to_resource` in +your AR model. + +```ruby +class User < ActiveRecord::Base + def to_resource + UserResource.new(self) + end +end + +class UserResource + include Garage::Representer + include Garage::Authorizable + + property :id + property :name + property :email + + delegate :id, :name, :email, to: :@model + + def initialize(model) + @model = model end end ``` ## Advanced Configurations