Class: Gatherable::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/gatherable/application_controller.rb,
lib/generators/gatherable/templates/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
# File 'app/controllers/gatherable/application_controller.rb', line 9

def create
  render :json => model_class.create(model_params), :status => :created
rescue ActionController::ParameterMissing => e
  render :json => { :errors => e.message}, :status => :unprocessable_entity
end

#showObject



3
4
5
6
7
# File 'app/controllers/gatherable/application_controller.rb', line 3

def show
  render :json => model_class.find(params[model_id]), :status => :found
rescue ActiveRecord::RecordNotFound => e
  render :json => { :errors => e.message}, :status => :not_found
end