initial commit
This commit is contained in:
34
app/controllers/guesses_controller.rb
Normal file
34
app/controllers/guesses_controller.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
class GuessesController < ApplicationController
|
||||
skip_before_filter :verify_authenticity_token
|
||||
#before_filter :allow_cors
|
||||
|
||||
|
||||
# GET /guesses
|
||||
# GET /guesses.json
|
||||
def index
|
||||
@guesses = Guess.all.order("created_at DESC")
|
||||
end
|
||||
|
||||
|
||||
# POST /guesses
|
||||
# POST /guesses.json
|
||||
def create
|
||||
@guess = Guess.new
|
||||
@guess.username = params[:username]
|
||||
@guess.definition = params[:definition]
|
||||
Rails.logger.debug(params.inspect)
|
||||
|
||||
respond_to do |format|
|
||||
if @guess.save
|
||||
format.json { render action: 'show', status: :created, location: @guess }
|
||||
else
|
||||
format.json { render json: @guess.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@guess = Guess.find(params[:id])
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user