Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SegredosController < ApplicationController
- def index
- @segredos = Segredo.all
- respond_with(@segredos)
- end
- def show
- @segredo = Segredo.find(params[:id])
- respond_with(@segredo)
- end
- def new
- @segredo = Segredo.new
- respond_with(@segredo)
- end
- def create
- @segredo = Segredo.new(segredo_params)
- if @segredo.save
- respond_with(@segredo, :location => segredos_url)
- else
- render :new
- end
- end
- private
- def segredo_params
- params.require(:segredo).permit(:secret)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement