Created
September 30, 2010 22:19
-
-
Save mrmemes-eth/605430 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThingsController < ApplicationController | |
respond_to :html, :json | |
# decent_exposure won't currently intuit a collection (plural resource) for you. The SLTD error is | |
# caused by a circular reference between an undeclared collection (which the singular resource attempts | |
# to scope from) and the singular resource. To fix this problem, just define the collection: | |
expose(:things) { Thing.all } | |
# or alternatively, something like: | |
# expose(:things) { current_user.things } | |
expose(:thing) | |
def create | |
thing.save | |
respond_with(thing) | |
end | |
def destroy | |
thing.destroy | |
respond_with(thing) | |
end | |
def update | |
thing.update_attributes(params[:thing]) | |
respond_with(thing) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment