README.markdown in roar-rails-0.0.6 vs README.markdown in roar-rails-0.0.7
- old
+ new
@@ -24,19 +24,31 @@
respond_with singer
end
end
```
-Need to use a representer with a different name than your model? Pass it in using the `:with_representer` option:
+Need to use a representer with a different name than your model? Pass it in using the `:represent_with` option:
```ruby
class SingersController < ApplicationController
include Roar::Rails::ControllerAdditions
respond_to :json
def show
singer = Musician.find_by_id(params[:id])
- respond_with singer, :with_representer => SingerRepresenter
+ respond_with singer, :represent_with => SingerRepresenter
+ end
+end
+```
+
+If you don't want to write a dedicated representer for a collection of items (highly recommended, thou) but rather use a representer for each item, use the `+represent_items_with+` option.
+
+```ruby
+class SingersController < ApplicationController
+
+ def index
+ singers = Musician.find(:all)
+ respond_with singers, :represent_items_with => SingerRepresenter
end
end
```
Goes great with [Jose Valim's responders gem][responders]!