Mercurial > zeropaste
diff app/controllers/pastes_controller.rb @ 499:d2ef59c9a4b4
Use rails rubocop
author | nanaya <me@nanaya.net> |
---|---|
date | Sun, 15 Dec 2024 22:33:27 +0900 |
parents | f11862e58af4 |
children |
line wrap: on
line diff
--- a/app/controllers/pastes_controller.rb Sun Dec 15 22:31:14 2024 +0900 +++ b/app/controllers/pastes_controller.rb Sun Dec 15 22:33:27 2024 +0900 @@ -6,9 +6,9 @@ return head :not_found unless @paste if params[:id] != @paste.to_param - redirect_to :action => :show, - :id => @paste.to_param, - :format => params[:format] + redirect_to action: :show, + id: @paste.to_param, + format: params[:format] return end @@ -33,21 +33,21 @@ # POST /pastes.json # POST /pastes.txt def create - created, @paste, @fresh = Paste.graceful_create paste_params.merge(:ip => request.remote_ip) + created, @paste, @fresh = Paste.graceful_create paste_params.merge(ip: request.remote_ip) respond_to do |format| if created if @fresh - format.html { redirect_to @paste, :notice => "Paste was successfully created." } - format.json { render :json => @paste, :status => :created, :location => @paste } + format.html { redirect_to @paste, notice: "Paste was successfully created." } + format.json { render json: @paste, status: :created, location: @paste } else format.html { redirect_to paste_path(@paste) } - format.json { render :json => @paste } + format.json { render json: @paste } end else flash.now[:alert] = @paste.errors.full_messages.to_sentence - format.html { render :action => "new" } - format.json { render :json => @paste.errors, :status => :unprocessable_entity } + format.html { render action: "new" } + format.json { render json: @paste.errors, status: :unprocessable_entity } end format.txt end @@ -56,7 +56,7 @@ def destroy @paste = Paste.safe_find(params[:id]) if @paste.safe_destroy(params[:paste][:key]) - redirect_to root_path, :notice => "Paste ##{params[:id]} deleted" + redirect_to root_path, notice: "Paste ##{params[:id]} deleted" else flash.now[:alert] = @paste.errors.full_messages.to_sentence render :show