Files
old-rijeci/app/controllers/solutions_controller.rb

38 lines
802 B
Ruby
Raw Normal View History

2013-12-09 03:23:49 +01:00
class SolutionsController < ApplicationController
skip_before_filter :verify_authenticity_token
#before_filter :allow_cors
# GET /solutions
# GET /solutions.json
def index
@solutions = Solution.all
end
# GET /solutions/1
# GET /solutions/1.json
def show
@solution = Solution.find(params[:id])
end
# POST /solutions
# POST /solutions.json
def create
@solution = Solution.new
@solution.time = params[:time]
@solution.number = params[:number].to_i
@solution.username = params[:username]
respond_to do |format|
if @solution.save
format.json { render action: 'show', status: :created, location: @solution }
else
format.json { render json: @solution.errors, status: :unprocessable_entity }
end
end
end
end