diff app/controllers/pastes_controller.rb @ 329:430dadffd91e

Fix coding style.
author edogawaconan <me@myconan.net>
date Mon, 14 Apr 2014 17:13:22 +0900
parents fec39456dcbe
children cd1c3a28b89a
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)