blob: 8c75dbf0867fe2835bcd12fa11edd90e3769009d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
module Api
module V1
class TutorialsController < ApiController
def index
@tutorials = current_user.tutorials.page(page).per(per_page)
end
def create
@tutorial = current_user.tutorials.create!(tutorial_params)
current_user.tag(@tutorial, with: params[:tutorial][:tags], on: :tags)
end
private
def tutorial_params
params.require(:tutorial).permit(:url, :image_url, :heading, :description)
end
end
end
end
|