Commit 5ab3e5c1
Changed files (7)
app
controllers
views
my
favorites
shared
config
spec
app/controllers/my/favorites_controller.rb
@@ -0,0 +1,9 @@
+module My
+ class FavoritesController < BaseController
+ def index
+ @user = current_user
+ @favorites = current_user.favorites.includes(:creation)
+ @creations = @favorites.map {|f| f.creation }
+ end
+ end
+end
app/controllers/profiles_controller.rb
@@ -12,10 +12,4 @@ class ProfilesController < ApplicationController
@nearby_users = @user.nearbys(50) || []
expires_in(1.hour)
end
-
- def favorites
- @user = current_user
- @favorites = current_user.favorites.includes(:creation)
- @creations = @favorites.map {|f| f.creation }
- end
end
app/views/profiles/favorites.html.erb → app/views/my/favorites/index.html.erb
File renamed without changes
config/routes.rb
@@ -22,7 +22,7 @@ Cake::Application.routes.draw do
resources :profiles, :only => [:index, :show] do
get 'page/:page', :action => :index, :on => :collection
end
- get 'favorites' => 'profiles#favorites', :as => 'profiles_favorites'
+ #get 'favorites' => 'profiles#favorites', :as => 'profiles_favorites'
# /categories
get 'categories/:slug' => "categories#show", :as => :category
@@ -68,7 +68,7 @@ Cake::Application.routes.draw do
namespace :my do
get 'dashboard', to: 'dashboard#index'
- resources :cakes do
- end
+ resources :cakes, only: [:index]
+ resources :favorites, only: [:index]
end
end
spec/routing/my/favorites_routing_spec.rb
@@ -0,0 +1,9 @@
+require 'spec_helper'
+
+describe My::FavoritesController do
+ describe "routing" do
+ it "routes to my favorites" do
+ get("/my/favorites").should route_to("my/favorites#index")
+ end
+ end
+end
spec/routing/profiles_routing_spec.rb
@@ -1,4 +1,5 @@
require 'spec_helper'
+
describe ProfilesController do
describe "routing" do
it "routes to index" do
@@ -8,9 +9,5 @@ describe ProfilesController do
it "routes to #show" do
get("/profiles/1").should route_to("profiles#show", :id => "1")
end
-
- it "routes to my favorites" do
- get("/favorites").should route_to("profiles#favorites")
- end
end
end