diff --git a/Gemfile b/Gemfile index 1f88e1c..ff0df91 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,6 @@ gem 'rails', '3.0.4' gem 'sqlite3' gem 'devise' - # Use unicorn as the web server # gem 'unicorn' diff --git a/app/controllers/links_controller.rb b/app/controllers/links_controller.rb index 93c35b9..30e0930 100644 --- a/app/controllers/links_controller.rb +++ b/app/controllers/links_controller.rb @@ -1,24 +1,18 @@ class LinksController < ApplicationController include LinksHelper - + respond_to :html, :xml, :json # GET /links # GET /links.xml def index @links = Link.all.sort { |linka,linkb| votecount(linkb) <=> votecount(linka) } - - respond_to do |format| - format.html # index.html.erb - end + respond_with(@links) end # GET /links/new # GET /links/new.xml def new @link = Link.new - - respond_to do |format| - format.html # new.html.erb - end + respond_with(@link) end # GET /links/1/edit @@ -63,11 +57,7 @@ def update # DELETE /links/1.xml def destroy @link = Link.find(params[:id]) - @link.destroy - - respond_to do |format| - format.html { redirect_to(links_url) } - end + respond_with(@link.destroy) end # PUT /links/1/upvote diff --git a/app/views/links/index.html.erb b/app/views/links/index.html.erb index e4da569..d1ebb2e 100644 --- a/app/views/links/index.html.erb +++ b/app/views/links/index.html.erb @@ -1,5 +1,5 @@ -<% if @links.count == 0 %> +<% if @links.empty? %>

No links have been submitted. Click the link below to add one.

<% else %>

Submitted Links

diff --git a/config/routes.rb b/config/routes.rb index 0fae6b4..6b2dd82 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,7 +7,6 @@ end get "home/index" - devise_for :users # The priority is based upon order of creation: