Sha256: 305aef49822001fb98af3c40f49175b788864ecc87ccb29e5586d9bc02d441d5
Contents?: true
Size: 920 Bytes
Versions: 2
Compression:
Stored size: 920 Bytes
Contents
require 'active_resource/exceptions' module Client class ScoRecordsController < ApplicationController ssl_required :complete skip_filter :authenticate_user!, :only => :complete protect_from_forgery :except => :complete def complete begin throw ActiveResource::UnauthorizedAccess.new('Invalid key') unless params.has_key?(:key) && params[:key] == APP_CONFIG['sco_record_completion_key'] sco = Sco.find_by_identifier_ref(params[:identifier_ref]) user = User.find_by_id(params[:user_id]) @sco_record = ScoRecord.by_sco(sco).for_user(user).first || ScoRecord.new(:sco => sco, :user => user) @sco_record.status = "completed" if @sco_record.save head :ok else throw ActiveResource::ResourceNotFound.new('Exercise record validation error') end rescue head :bad_request end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
scidea-cv-sco_completion-0.0.2 | app/controllers/client/sco_records_controller.rb |
scidea-cv-sco_completion-0.0.1 | app/controllers/client/sco_records_controller.rb |