Permalink
Browse files

wire up after_register path

  • Loading branch information...
schneems committed Feb 23, 2012
1 parent 7cc9657 commit a9a785bf916e970244c7f1b4c692fd035499ef21
@@ -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 after_register controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,12 @@
+class AfterRegisterController < ApplicationController
+ before_filter :authenticate_user!
+
+
+ def show
+ @user = User.last
+ end
+
+ def update
+
+ end
+end
@@ -0,0 +1,12 @@
+class RegistrationsController < Devise::RegistrationsController
+
+ def create
+ super
+ end
+
+ protected
+ def after_sign_up_path_for(resource)
+ # previous_path_or(resource)
+ after_register_path(:add_zip)
+ end
+end
@@ -1,5 +1,15 @@
class UsersController < ApplicationController
+
+ before_filter :authenticate_user!, :only => :update
+
+
def show
@user = User.find(params[:id])
end
+
+ def update
+ @user = current_user
+ @user.update_attributes(params[:user])
+ render :edit
+ end
end
@@ -0,0 +1,2 @@
+module AfterRegisterHelper
+end
@@ -0,0 +1,6 @@
+<h2>Thanks for Signing Up</h2>
+<p>Please Fill in your zip code!</p>
+<%= form_for(@user) do |f| %>
+ <%= f.text_field :zip, :placeholder => "zip code" %>
+ <%= f.submit 'Next', :class => 'btn btn-primary' %>
+<% end %>
View
@@ -1,8 +1,12 @@
WickedExample::Application.routes.draw do
- devise_for :users
- resources :users
- root :to => "pages#index"
+ devise_for :users, :controllers => { :registrations => "registrations" }
+
+ root :to => "pages#index"
+
+ resources :after_register
+
+ resources :users
# The priority is based upon order of creation:
View
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120222223509) do
+ActiveRecord::Schema.define(:version => 20120222231841) do
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
@@ -26,6 +26,9 @@
t.string "last_sign_in_ip"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.string "zip"
+ t.string "phone_number"
+ t.boolean "twitter"
end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class AfterRegisterControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class AfterRegisterHelperTest < ActionView::TestCase
+end

0 comments on commit a9a785b

Please sign in to comment.