Permalink
Browse files

README

  • Loading branch information...
1 parent a489f9e commit 734eb74945c1c0dc42d9891ef1279fd09e22006c @diasks2 committed Apr 29, 2012
View
@@ -215,11 +215,26 @@ You can copy the code from [this example](https://github.com/diasks2/surveyor_ex
end
-30) Add a page to show user info at [app/views/users/show.html.erb]()
+30) Add a page to show user info at [app/views/users/show.html.erb](https://github.com/diasks2/surveyor_example/blob/master/app/views/users/show.html.erb)
<%= @user.name %>, <%= @user.email %>
+31) Generate a Sessions Controller
+ $ rails generate controller Sessions
+
+32) Update the [config/routes.rb](https://github.com/diasks2/surveyor_example/blob/master/config/routes.rb) file:
+
+ SurveyorExample::Application.routes.draw do
+ resources :users
+ resources :sessions, only: [:new, :create, :destroy]
+
+ match '/signup', to: 'users#new'
+ match '/signin', to: 'sessions#new'
+ match '/signout', to: 'sessions#destroy', via: :delete
+ end
+
+33)
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
+// Place all the styles related to the Sessions controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,11 @@
+class SessionsController < ApplicationController
+
+ def new
+ end
+
+ def create
+ end
+
+ def destroy
+ end
+end
@@ -0,0 +1,2 @@
+module SessionsHelper
+end
View
@@ -1,7 +1,10 @@
SurveyorExample::Application.routes.draw do
resources :users
+ resources :sessions, only: [:new, :create, :destroy]
match '/signup', to: 'users#new'
+ match '/signin', to: 'sessions#new'
+ match '/signout', to: 'sessions#destroy', via: :delete
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe SessionsController do
+
+end
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the SessionsHelper. For example:
+#
+# describe SessionsHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# helper.concat_strings("this","that").should == "this that"
+# end
+# end
+# end
+describe SessionsHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end

0 comments on commit 734eb74

Please sign in to comment.