about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/machines_controller.rb8
-rw-r--r--app/controllers/players_controller.rb11
2 files changed, 8 insertions, 11 deletions
diff --git a/app/controllers/machines_controller.rb b/app/controllers/machines_controller.rb
index d83a52f..3ef5893 100644
--- a/app/controllers/machines_controller.rb
+++ b/app/controllers/machines_controller.rb
@@ -5,7 +5,7 @@ class MachinesController < ApplicationController
 
   # GET /machines or /machines.json
   def index
-    @machines = Machine.all
+    @machines = Machine.order(:name)
   end
 
   # GET /machines/1 or /machines/1.json
@@ -25,7 +25,7 @@ class MachinesController < ApplicationController
 
     respond_to do |format|
       if @machine.save
-        format.html { redirect_to machine_url(@machine), notice: 'Machine was successfully created.' }
+        format.html { redirect_to machines_url, notice: 'Machine was successfully created.' }
         format.json { render :show, status: :created, location: @machine }
       else
         format.html { render :new, status: :unprocessable_entity }
@@ -38,10 +38,10 @@ class MachinesController < ApplicationController
   def update
     respond_to do |format|
       if @machine.update(machine_params)
-        format.html { redirect_to machine_url(@machine), notice: 'Machine was successfully updated.' }
+        format.html { redirect_to machines_url, notice: 'Machine was successfully updated.' }
         format.json { render :show, status: :ok, location: @machine }
       else
-        format.html { render :edit, status: :unprocessable_entity }
+        format.html { render :show, status: :unprocessable_entity }
         format.json { render json: @machine.errors, status: :unprocessable_entity }
       end
     end
diff --git a/app/controllers/players_controller.rb b/app/controllers/players_controller.rb
index c1139e1..44034e5 100644
--- a/app/controllers/players_controller.rb
+++ b/app/controllers/players_controller.rb
@@ -5,7 +5,7 @@ class PlayersController < ApplicationController
 
   # GET /players or /players.json
   def index
-    @players = Player.all
+    @players = Player.order(:name)
   end
 
   # GET /players/1 or /players/1.json
@@ -16,16 +16,13 @@ class PlayersController < ApplicationController
     @player = Player.new
   end
 
-  # GET /players/1/edit
-  def edit; end
-
   # POST /players or /players.json
   def create
     @player = Player.new(player_params)
 
     respond_to do |format|
       if @player.save
-        format.html { redirect_to player_url(@player), notice: 'Player was successfully created.' }
+        format.html { redirect_to players_url, notice: 'Player was successfully created.' }
         format.json { render :show, status: :created, location: @player }
       else
         format.html { render :new, status: :unprocessable_entity }
@@ -38,10 +35,10 @@ class PlayersController < ApplicationController
   def update
     respond_to do |format|
       if @player.update(player_params)
-        format.html { redirect_to player_url(@player), notice: 'Player was successfully updated.' }
+        format.html { redirect_to players_url, notice: 'Player was successfully updated.' }
         format.json { render :show, status: :ok, location: @player }
       else
-        format.html { render :edit, status: :unprocessable_entity }
+        format.html { render :show, status: :unprocessable_entity }
         format.json { render json: @player.errors, status: :unprocessable_entity }
       end
     end