6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/controllers/records_controller.rb', line 6
def create
task = Task.find params[:task_id]
if task.prototype.mockup_ids.include?(params[:mockup_id].to_i) && task.test.id == params[:test_id].to_i
@record.prototype_id = task.prototype.id
@record.project_id = task.project.id
@record.user_id = current_user.id
@record.events = params[:events]
@record.save
render json: @record, status: :created
else
render json: { errors: 'Wrong attributes!' }, status: :unprocessable_entity
end
end
|