From dacfc99ce7c99d61ed88e872d5ac58a5c1fe825f Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 31 Jul 2011 22:17:59 -0400 Subject: [PATCH] allow your_items_path to be cached on home --- app/controllers/closet_hangers_controller.rb | 4 +++- app/helpers/items_helper.rb | 4 ---- config/routes.rb | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/controllers/closet_hangers_controller.rb b/app/controllers/closet_hangers_controller.rb index 94e877f9..b75a5a70 100644 --- a/app/controllers/closet_hangers_controller.rb +++ b/app/controllers/closet_hangers_controller.rb @@ -97,8 +97,10 @@ class ClosetHangersController < ApplicationController def find_user if params[:user_id] @user = User.find params[:user_id] - else + elsif user_signed_in? redirect_to user_closet_hangers_path(current_user) + else + redirect_to login_path(:return_to => request.fullpath) end end diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index 17c760c8..55540a3a 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -88,10 +88,6 @@ module ItemsHelper end.to_sentence.html_safe end - def your_items_path - user_signed_in? ? user_closet_hangers_path(current_user) : login_path(:return_to => current_user_items_path) - end - private def build_on_pet_types(species, special_color=nil, &block) diff --git a/config/routes.rb b/config/routes.rb index ffe8538f..7a19db34 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -55,7 +55,7 @@ OpenneoImpressItems::Application.routes.draw do |map| end end - match 'users/current-user/closet' => 'closet_hangers#index', :as => :current_user_items + match 'users/current-user/closet' => 'closet_hangers#index', :as => :your_items match 'users/top-contributors' => 'users#top_contributors', :as => :top_contributors match 'users/top_contributors' => redirect('/users/top-contributors')