Skip to content
Browse files

wire up after_register path

  • Loading branch information...
1 parent 7cc9657 commit a9a785bf916e970244c7f1b4c692fd035499ef21 @schneems committed
View
3 app/assets/javascripts/after_register.js.coffee
@@ -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/
View
3 app/assets/stylesheets/after_register.css.scss
@@ -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/
View
12 app/controllers/after_register_controller.rb
@@ -0,0 +1,12 @@
+class AfterRegisterController < ApplicationController
+ before_filter :authenticate_user!
+
+
+ def show
+ @user = User.last
+ end
+
+ def update
+
+ end
+end
View
12 app/controllers/registrations_controller.rb
@@ -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
View
10 app/controllers/users_controller.rb
@@ -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
View
2 app/helpers/after_register_helper.rb
@@ -0,0 +1,2 @@
+module AfterRegisterHelper
+end
View
6 app/views/after_register/show.html.erb
@@ -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
10 config/routes.rb
@@ -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
5 db/schema.rb
@@ -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
View
7 test/functional/after_register_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class AfterRegisterControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
View
4 test/unit/helpers/after_register_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class AfterRegisterHelperTest < ActionView::TestCase
+end

0 comments on commit a9a785b

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