|
|
|
@ -1,4 +1,6 @@
|
|
|
|
class FruitsController < ApplicationController
|
|
|
|
class FruitsController < ApplicationController
|
|
|
|
|
|
|
|
skip_before_action :verify_authenticity_token
|
|
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
def index
|
|
|
|
# render({ :json => { :message => 'hi', :status => 200 } })
|
|
|
|
# render({ :json => { :message => 'hi', :status => 200 } })
|
|
|
|
# render json: message: 'hi', status: 200 # doesn't work because nested objects are unguessable
|
|
|
|
# render json: message: 'hi', status: 200 # doesn't work because nested objects are unguessable
|
|
|
|
@ -8,4 +10,8 @@ class FruitsController < ApplicationController
|
|
|
|
def show
|
|
|
|
def show
|
|
|
|
render json: Fruit.find(params[:id])
|
|
|
|
render json: Fruit.find(params[:id])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create
|
|
|
|
|
|
|
|
render json: Fruit.create(params["fruit"])
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|