Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Document a case when you need to use the "inherit_resources" macro. #211

Merged
merged 1 commit into from

3 participants

@mforsyth

Hi there - I came across a case where I needed to use the "inherit_resources" macro rather than inheriting from InheritedResources::Base, and I would have found it helpful if this type of situation was more verbosely described in the documentation. So I've added an example of the type of scenario where "inherit_resources" comes in handy.

@Salzig

+1

@rafaelfranca rafaelfranca merged commit d1d0395 into josevalim:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 0 deletions.
  1. +8 −0 README.rdoc
View
8 README.rdoc
@@ -126,6 +126,14 @@ call inherit_resources in your controller class scope:
inherit_resources
end
+One reason to use the "inherit_resources" macro would be to ensure that your controller never responds with the html mime-type. InheritedResources::Base already responds_to :html, and the respond_to macro is strictly additive. Therefore, if you want to create a controller that, for example, responds ONLY via :js, you will have write it this way:
+
+ class AccountsController < ApplicationController
+ respond_to :js
+ inherit_resources
+ end
+
+
== Overwriting defaults
Whenever you inherit from InheritedResources, several defaults are assumed.
Something went wrong with that request. Please try again.