Class: Api::V1::CrumbsController

Inherits:
BaseController show all
Defined in:
app/controllers/api/v1/crumbs_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#add_generic_headers!, #authenticate_api_user!, #authenticate_user_from_simple_token!, #force_json!

Instance Method Details

#createObject


27
28
29
30
31
32
33
34
35
# File 'app/controllers/api/v1/crumbs_controller.rb', line 27

def create
  crumb = Crumb.new(permitted_params)
  crumb.user = current_user
  if crumb.save
    render json: { id: crumb.id }, status: :created
  else
    render json: crumb.errors, status: :unprocessable_entity
  end
end

#indexObject


23
24
25
# File 'app/controllers/api/v1/crumbs_controller.rb', line 23

def index
  render json: current_user.crumbs, status: :ok
end