Mercurial > zeropaste
changeset 329:430dadffd91e
Fix coding style.
author | edogawaconan <me@myconan.net> |
---|---|
date | Mon, 14 Apr 2014 17:13:22 +0900 |
parents | 2dda4100cb82 |
children | 96631607785f |
files | app/controllers/pastes_controller.rb |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controllers/pastes_controller.rb Mon Apr 14 16:48:19 2014 +0900 +++ b/app/controllers/pastes_controller.rb Mon Apr 14 17:13:22 2014 +0900 @@ -5,7 +5,7 @@ # GET /1.txt def show @paste = Paste.safe_find(params[:id]) - head :not_found and return unless @paste + return head :not_found unless @paste respond_to do |format| format.html { cache } @@ -28,13 +28,13 @@ # POST /pastes.json # POST /pastes.txt def create - @paste = Paste.new(paste_params.merge(ip: request.remote_ip)) + @paste = Paste.new paste_params.merge(:ip => request.remote_ip) begin respond_to do |format| if @paste.save @fresh = true - format.html { redirect_to @paste, :notice => 'Paste was successfully created.' } + format.html { redirect_to @paste, :notice => "Paste was successfully created." } format.json { render :json => @paste, :status => :created, :location => @paste } else flash.now[:alert] = @paste.errors.full_messages.to_sentence @@ -68,8 +68,9 @@ def lowercase_path correct_path = request.fullpath.downcase - redirect_to correct_path, :status => :moved_permanently unless - correct_path == request.fullpath + unless correct_path == request.fullpath + redirect_to correct_path, :status => :moved_permanently + end end def cache_key(format = request.format.symbol)