From 32fa860dbd31773d1a45a3e1bdd87fb91a298341 Mon Sep 17 00:00:00 2001 From: tehjaymo Date: Mon, 15 Oct 2012 23:11:29 +0100 Subject: [PATCH] Created profile controller, route and view. It's under the /profile route rather than /user to avoid clashes with autogenerated Devise pages. --- app/controllers/profile_controller.rb | 10 ++++++++++ app/views/profile/show.html.haml | 2 ++ config/routes.rb | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 app/controllers/profile_controller.rb create mode 100644 app/views/profile/show.html.haml diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb new file mode 100644 index 000000000..bac28d586 --- /dev/null +++ b/app/controllers/profile_controller.rb @@ -0,0 +1,10 @@ +class ProfileController < ApplicationController + def show + @user = User.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @user } + end + end +end diff --git a/app/views/profile/show.html.haml b/app/views/profile/show.html.haml new file mode 100644 index 000000000..95a5bf973 --- /dev/null +++ b/app/views/profile/show.html.haml @@ -0,0 +1,2 @@ +- content_for :title, "Profile for " + @user.username + diff --git a/config/routes.rb b/config/routes.rb index da8709c5c..7a5148a87 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Growstuff::Application.routes.draw do - resources :crops + resources :crops, :profile devise_for :users