Skip to content
Browse files

Adds editor route, action and link

  • Loading branch information...
1 parent 5af1fbf commit 58233649482046c77b46adcc43b92493e5b3e0f0 @kandalf kandalf committed Aug 7, 2011
Showing with 7 additions and 1 deletion.
  1. +4 −0 app/controllers/users_controller.rb
  2. +1 −1 app/views/home/index.html.haml
  3. +2 −0 config/routes.rb
View
4 app/controllers/users_controller.rb
@@ -11,4 +11,8 @@ def create
render "new"
end
end
+
+ def editor
+ @friend = current_user.friends.find(params[:friend_id])
+ end
end
View
2 app/views/home/index.html.haml
@@ -4,7 +4,7 @@
%ul#friendsList
-current_user.friends.each do |friend|
%li.friend{ :class => cycle("even", "odd") }
- =link_to friend.email
+ =link_to friend.email, "/users/#{current_user.id}/editor/#{friend.id}"
%section#inviteSection
%h1 Your friend is not here?
View
2 config/routes.rb
@@ -6,6 +6,8 @@
post 'sessions' => 'sessions#create'
get 'sessions/destroy' => 'sessions#destroy', :as => :logout
+ match 'users/:id/editor/:friend_id' => 'users#editor', :as => :user_editor
+
# The priority is based upon order of creation:
# first created -> highest priority.

0 comments on commit 5823364

Please sign in to comment.
Something went wrong with that request. Please try again.