Skip to content

Commit

Permalink
Remove unnecessary routes
Browse files Browse the repository at this point in the history
  • Loading branch information
sorah committed May 24, 2014
1 parent ba7c8cd commit 87e7f46
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 31 deletions.
24 changes: 1 addition & 23 deletions app/controllers/stuffs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,14 @@ class StuffsController < ApplicationController
# GET /stuffs.json
def index
@stuffs = Stuff.all
@stuff = Stuff.new
end

# GET /stuffs/1
# GET /stuffs/1.json
def show
end

# GET /stuffs/new
def new
@stuff = Stuff.new
end

# GET /stuffs/1/edit
def edit
end

# POST /stuffs
# POST /stuffs.json
def create
Expand All @@ -37,20 +29,6 @@ def create
end
end

# PATCH/PUT /stuffs/1
# PATCH/PUT /stuffs/1.json
def update
respond_to do |format|
if @stuff.update(stuff_params)
format.html { redirect_to @stuff, notice: 'Stuff was successfully updated.' }
format.json { render :show, status: :ok, location: @stuff }
else
format.html { render :edit }
format.json { render json: @stuff.errors, status: :unprocessable_entity }
end
end
end

# DELETE /stuffs/1
# DELETE /stuffs/1.json
def destroy
Expand Down
8 changes: 2 additions & 6 deletions app/views/stuffs/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<h1>Listing stuffs</h1>

<%= render 'form' %>

<table>
<thead>
<tr>
Expand All @@ -21,13 +23,7 @@
<td><%= stuff.filename %></td>
<td><%= stuff.encrypted_password %></td>
<td><%= link_to 'Show', stuff %></td>
<td><%= link_to 'Edit', edit_stuff_path(stuff) %></td>
<td><%= link_to 'Destroy', stuff, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>

<br>

<%= link_to 'New Stuff', new_stuff_path %>
1 change: 0 additions & 1 deletion app/views/stuffs/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<h1>New stuff</h1>

<%= render 'form' %>

<%= link_to 'Back', stuffs_path %>
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
resources :stuffs
resources :stuffs, only: %i(index create show)

# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
Expand Down

0 comments on commit 87e7f46

Please sign in to comment.