Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save snusnu/32342 to your computer and use it in GitHub Desktop.
Save snusnu/32342 to your computer and use it in GitHub Desktop.
class Articles < Application
controlling :articles do |a|
a.action :new, :only_provides => :html
a.action :edit, :only_provides => :html
a.action :create, :provides => [ :xml, :json, :yml ] do
a.on_success { display member, :status => 201, :location => resource(member) }
a.on_failure { display member.errors, :status => 422 }
end
a.action :update, :provides => [ :xml, :json, :yml ] do
a.on_success { EMPTY_RESPONSE }
a.on_failure { display member.errors, :status => 422 }
end
a.action :destroy, :provides => [ :xml, :json, :yml ] do
a.on_success { EMPTY_RESPONSE }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment