Module: Mongosteen::Actions
- Defined in:
- lib/mongosteen/actions.rb
Instance Method Summary collapse
-
#create(options = {}, &block) ⇒ Object
POST /resources.
-
#index(options = {}, &block) ⇒ Object
GET /resources.
-
#show(options = {}, &block) ⇒ Object
GET /resources/1.
-
#update(options = {}, &block) ⇒ Object
PUT /resources/1.
Instance Method Details
#create(options = {}, &block) ⇒ Object
POST /resources
18 19 20 21 22 23 |
# File 'lib/mongosteen/actions.rb', line 18 def create(={}, &block) super do |success, failure| success.json { render json: get_resource_ivar.as_json(as_json_config) } failure.json { render json: get_resource_ivar.errors, status: :unprocessable_entity } end end |
#index(options = {}, &block) ⇒ Object
GET /resources
4 5 6 7 8 |
# File 'lib/mongosteen/actions.rb', line 4 def index(={}, &block) super do |success, failure| success.json { render json: get_collection_ivar.as_json(as_json_config) } end end |
#show(options = {}, &block) ⇒ Object
GET /resources/1
11 12 13 14 15 |
# File 'lib/mongosteen/actions.rb', line 11 def show(={}, &block) super do |success, failure| success.json { render json: get_resource_version.as_json(as_json_config) } end end |
#update(options = {}, &block) ⇒ Object
PUT /resources/1
26 27 28 29 30 31 |
# File 'lib/mongosteen/actions.rb', line 26 def update(={}, &block) super do |success, failure| success.json { render json: get_resource_ivar.as_json(as_json_config) } failure.json { render json: get_resource_ivar.errors, status: :unprocessable_entity } end end |