Skip to content

Commit

Permalink
fix bag with json.jbuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
dimanado committed Oct 4, 2015
1 parent 8facab7 commit 90a0059
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion app/controllers/courses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ class CoursesController < ApplicationController

def index
@courses=current_user.courses
render json: {}, status: :ok
end

def create
Expand Down
3 changes: 3 additions & 0 deletions app/views/courses/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
json.courses do
json.array! @courses, :id, :name
end
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

mount_devise_token_auth_for 'User', at: 'auth'

resources :courses
resources :courses, format: 'json'
end

0 comments on commit 90a0059

Please sign in to comment.