2014-02-13 00:20:16 -05:00
|
|
|
class PastesController < ApplicationController
|
|
|
|
def index
|
2014-02-14 15:54:22 -05:00
|
|
|
@pastes = Paste.all
|
2014-02-13 00:20:16 -05:00
|
|
|
end
|
|
|
|
|
2014-02-14 15:54:22 -05:00
|
|
|
def show
|
|
|
|
@paste = Paste.find(params[:id])
|
2014-02-13 00:20:16 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
2014-02-14 15:54:22 -05:00
|
|
|
@paste = Paste.new
|
2014-02-13 00:20:16 -05:00
|
|
|
end
|
|
|
|
|
2014-02-14 15:54:22 -05:00
|
|
|
def edit
|
2014-02-13 00:20:16 -05:00
|
|
|
end
|
|
|
|
|
2014-02-14 15:54:22 -05:00
|
|
|
def create
|
|
|
|
@paste = Paste.new(paste_params)
|
|
|
|
|
|
|
|
if @paste.save
|
|
|
|
flash[:success] = "Your paste has been added"
|
|
|
|
redirect_to @paste
|
|
|
|
else
|
|
|
|
flash.now[:danger] = "There was an error submitting your form"
|
|
|
|
render 'new'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2014-02-13 00:20:16 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
end
|
2014-02-14 15:54:22 -05:00
|
|
|
|
|
|
|
private
|
|
|
|
def paste_params
|
|
|
|
params.require(:paste).permit(:content)
|
|
|
|
end
|
2014-02-13 00:20:16 -05:00
|
|
|
end
|