8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/controllers/wco/api/videos_controller.rb', line 8
def create
@video = Wco::Video.new({ name: params[:name],
thumb: params[:thumb],
video: params[:video],
newspartial_id: params[:newspartial_id],
})
authorize! :create, @video
if @video.save
puts! @video, 'Created @video.'
flash[:notice] = 'Success'
render json: { status: :ok, message: @video.attributes }
else
flash[:alert] = 'No luck'
render json: { status: :not_ok, message: 'Could not create video.' }
end
end
|