README.markdown in roar-rails-0.0.12 vs README.markdown in roar-rails-0.0.13

- old
+ new

@@ -70,27 +70,11 @@ respond_with singers, :represent_items_with => SingerRepresenter end end ``` -Goes great with [Jose Valim's responders gem][responders]! -```ruby -class SingersController < ApplicationController - respond_to :json - - responders Roar::Rails::Responder - - def show - singer = Singer.find_by_id(params[:id]) - respond_with singer - end - -end -``` - - ## Parsing incoming documents In `#create` and `#update` actions it is often necessary to parse the incoming representation and map it to a model instance. Use the `#consume!` method for this. ```ruby @@ -131,9 +115,26 @@ include Roar::Representer::JSON property :name end ``` + +## Passing Options + +Both rendering and consuming support passing user options to the representer. + +With `#respond_with`, any additional options will be passed to `to_json` (or whatever format you're using). + +```ruby +respond_with @singer, :current_user => current_user +``` + +Same goes with `#consume!`, passing options to `from_json`. + +```ruby +consume! Singer.new, :current_user => current_user +``` + ## URL Helpers Any URL helpers from the Rails app are automatically available in representers.