namxam-devise 1.1.0.win
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +455 -0
- data/Gemfile +23 -0
- data/Gemfile.lock +118 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +311 -0
- data/Rakefile +55 -0
- data/TODO +3 -0
- data/app/controllers/devise/confirmations_controller.rb +33 -0
- data/app/controllers/devise/passwords_controller.rb +41 -0
- data/app/controllers/devise/registrations_controller.rb +57 -0
- data/app/controllers/devise/sessions_controller.rb +23 -0
- data/app/controllers/devise/unlocks_controller.rb +34 -0
- data/app/helpers/devise_helper.rb +17 -0
- data/app/mailers/devise/mailer.rb +71 -0
- data/app/views/devise/confirmations/new.html.erb +12 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +16 -0
- data/app/views/devise/passwords/new.html.erb +12 -0
- data/app/views/devise/registrations/edit.html.erb +25 -0
- data/app/views/devise/registrations/new.html.erb +18 -0
- data/app/views/devise/sessions/new.html.erb +17 -0
- data/app/views/devise/shared/_links.erb +19 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/config/locales/en.yml +39 -0
- data/lib/devise.rb +290 -0
- data/lib/devise/controllers/helpers.rb +231 -0
- data/lib/devise/controllers/internal_helpers.rb +98 -0
- data/lib/devise/controllers/scoped_views.rb +35 -0
- data/lib/devise/controllers/url_helpers.rb +41 -0
- data/lib/devise/encryptors/authlogic_sha512.rb +19 -0
- data/lib/devise/encryptors/base.rb +20 -0
- data/lib/devise/encryptors/bcrypt.rb +19 -0
- data/lib/devise/encryptors/clearance_sha1.rb +17 -0
- data/lib/devise/encryptors/restful_authentication_sha1.rb +22 -0
- data/lib/devise/encryptors/sha1.rb +25 -0
- data/lib/devise/encryptors/sha512.rb +25 -0
- data/lib/devise/failure_app.rb +107 -0
- data/lib/devise/hooks/activatable.rb +11 -0
- data/lib/devise/hooks/forgetable.rb +11 -0
- data/lib/devise/hooks/rememberable.rb +35 -0
- data/lib/devise/hooks/timeoutable.rb +22 -0
- data/lib/devise/hooks/trackable.rb +9 -0
- data/lib/devise/mapping.rb +103 -0
- data/lib/devise/models.rb +80 -0
- data/lib/devise/models/authenticatable.rb +126 -0
- data/lib/devise/models/confirmable.rb +164 -0
- data/lib/devise/models/database_authenticatable.rb +110 -0
- data/lib/devise/models/lockable.rb +165 -0
- data/lib/devise/models/recoverable.rb +81 -0
- data/lib/devise/models/registerable.rb +8 -0
- data/lib/devise/models/rememberable.rb +104 -0
- data/lib/devise/models/timeoutable.rb +26 -0
- data/lib/devise/models/token_authenticatable.rb +60 -0
- data/lib/devise/models/trackable.rb +30 -0
- data/lib/devise/models/validatable.rb +53 -0
- data/lib/devise/modules.rb +23 -0
- data/lib/devise/orm/active_record.rb +36 -0
- data/lib/devise/orm/mongoid.rb +29 -0
- data/lib/devise/path_checker.rb +18 -0
- data/lib/devise/rails.rb +69 -0
- data/lib/devise/rails/routes.rb +248 -0
- data/lib/devise/rails/warden_compat.rb +39 -0
- data/lib/devise/schema.rb +97 -0
- data/lib/devise/strategies/authenticatable.rb +111 -0
- data/lib/devise/strategies/base.rb +33 -0
- data/lib/devise/strategies/database_authenticatable.rb +21 -0
- data/lib/devise/strategies/rememberable.rb +43 -0
- data/lib/devise/strategies/token_authenticatable.rb +49 -0
- data/lib/devise/test_helpers.rb +90 -0
- data/lib/devise/version.rb +3 -0
- data/lib/generators/active_record/devise_generator.rb +28 -0
- data/lib/generators/active_record/templates/migration.rb +29 -0
- data/lib/generators/devise/devise_generator.rb +17 -0
- data/lib/generators/devise/install_generator.rb +24 -0
- data/lib/generators/devise/orm_helpers.rb +23 -0
- data/lib/generators/devise/templates/README +25 -0
- data/lib/generators/devise/templates/devise.rb +139 -0
- data/lib/generators/devise/views_generator.rb +63 -0
- data/lib/generators/devise_install_generator.rb +4 -0
- data/lib/generators/devise_views_generator.rb +4 -0
- data/lib/generators/mongoid/devise_generator.rb +17 -0
- data/test/controllers/helpers_test.rb +213 -0
- data/test/controllers/internal_helpers_test.rb +51 -0
- data/test/controllers/url_helpers_test.rb +58 -0
- data/test/devise_test.rb +65 -0
- data/test/encryptors_test.rb +30 -0
- data/test/failure_app_test.rb +123 -0
- data/test/integration/authenticatable_test.rb +344 -0
- data/test/integration/confirmable_test.rb +104 -0
- data/test/integration/database_authenticatable_test.rb +38 -0
- data/test/integration/http_authenticatable_test.rb +49 -0
- data/test/integration/lockable_test.rb +109 -0
- data/test/integration/recoverable_test.rb +141 -0
- data/test/integration/registerable_test.rb +153 -0
- data/test/integration/rememberable_test.rb +91 -0
- data/test/integration/timeoutable_test.rb +80 -0
- data/test/integration/token_authenticatable_test.rb +88 -0
- data/test/integration/trackable_test.rb +64 -0
- data/test/mailers/confirmation_instructions_test.rb +80 -0
- data/test/mailers/reset_password_instructions_test.rb +68 -0
- data/test/mailers/unlock_instructions_test.rb +62 -0
- data/test/mapping_test.rb +85 -0
- data/test/models/confirmable_test.rb +221 -0
- data/test/models/database_authenticatable_test.rb +148 -0
- data/test/models/lockable_test.rb +188 -0
- data/test/models/recoverable_test.rb +138 -0
- data/test/models/rememberable_test.rb +176 -0
- data/test/models/timeoutable_test.rb +28 -0
- data/test/models/token_authenticatable_test.rb +37 -0
- data/test/models/trackable_test.rb +5 -0
- data/test/models/validatable_test.rb +99 -0
- data/test/models_test.rb +77 -0
- data/test/orm/active_record.rb +9 -0
- data/test/orm/mongoid.rb +10 -0
- data/test/rails_app/app/active_record/admin.rb +3 -0
- data/test/rails_app/app/active_record/shim.rb +2 -0
- data/test/rails_app/app/active_record/user.rb +7 -0
- data/test/rails_app/app/controllers/admins_controller.rb +6 -0
- data/test/rails_app/app/controllers/application_controller.rb +9 -0
- data/test/rails_app/app/controllers/home_controller.rb +7 -0
- data/test/rails_app/app/controllers/publisher/registrations_controller.rb +2 -0
- data/test/rails_app/app/controllers/publisher/sessions_controller.rb +2 -0
- data/test/rails_app/app/controllers/sessions_controller.rb +6 -0
- data/test/rails_app/app/controllers/users_controller.rb +18 -0
- data/test/rails_app/app/helpers/application_helper.rb +3 -0
- data/test/rails_app/app/mongoid/admin.rb +6 -0
- data/test/rails_app/app/mongoid/shim.rb +16 -0
- data/test/rails_app/app/mongoid/user.rb +10 -0
- data/test/rails_app/config/application.rb +35 -0
- data/test/rails_app/config/boot.rb +13 -0
- data/test/rails_app/config/environment.rb +5 -0
- data/test/rails_app/config/environments/development.rb +19 -0
- data/test/rails_app/config/environments/production.rb +33 -0
- data/test/rails_app/config/environments/test.rb +33 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_app/config/initializers/devise.rb +136 -0
- data/test/rails_app/config/initializers/inflections.rb +2 -0
- data/test/rails_app/config/initializers/secret_token.rb +2 -0
- data/test/rails_app/config/routes.rb +47 -0
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +27 -0
- data/test/rails_app/db/schema.rb +86 -0
- data/test/routes_test.rb +146 -0
- data/test/support/assertions.rb +24 -0
- data/test/support/helpers.rb +54 -0
- data/test/support/integration.rb +88 -0
- data/test/support/test_silencer.rb +5 -0
- data/test/support/webrat/integrations/rails.rb +32 -0
- data/test/test_helper.rb +21 -0
- data/test/test_helpers_test.rb +72 -0
- metadata +230 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TimeoutableTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test 'should be expired' do
|
6
|
+
assert new_user.timedout?(31.minutes.ago)
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'should not be expired' do
|
10
|
+
assert_not new_user.timedout?(29.minutes.ago)
|
11
|
+
end
|
12
|
+
|
13
|
+
test 'should not be expired when params is nil' do
|
14
|
+
assert_not new_user.timedout?(nil)
|
15
|
+
end
|
16
|
+
|
17
|
+
test 'fallback to Devise config option' do
|
18
|
+
swap Devise, :timeout_in => 1.minute do
|
19
|
+
user = new_user
|
20
|
+
assert user.timedout?(2.minutes.ago)
|
21
|
+
assert_not user.timedout?(30.seconds.ago)
|
22
|
+
|
23
|
+
Devise.timeout_in = 5.minutes
|
24
|
+
assert_not user.timedout?(2.minutes.ago)
|
25
|
+
assert user.timedout?(6.minutes.ago)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TokenAuthenticatableTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test 'should reset authentication token' do
|
6
|
+
user = new_user
|
7
|
+
user.reset_authentication_token
|
8
|
+
previous_token = user.authentication_token
|
9
|
+
user.reset_authentication_token
|
10
|
+
assert_not_equal previous_token, user.authentication_token
|
11
|
+
end
|
12
|
+
|
13
|
+
test 'should ensure authentication token' do
|
14
|
+
user = new_user
|
15
|
+
user.ensure_authentication_token
|
16
|
+
previous_token = user.authentication_token
|
17
|
+
user.ensure_authentication_token
|
18
|
+
assert_equal previous_token, user.authentication_token
|
19
|
+
end
|
20
|
+
|
21
|
+
test 'should authenticate a valid user with authentication token and return it' do
|
22
|
+
user = create_user
|
23
|
+
user.ensure_authentication_token!
|
24
|
+
user.confirm!
|
25
|
+
authenticated_user = User.find_for_token_authentication(:auth_token => user.authentication_token)
|
26
|
+
assert_equal authenticated_user, user
|
27
|
+
end
|
28
|
+
|
29
|
+
test 'should return nil when authenticating an invalid user by authentication token' do
|
30
|
+
user = create_user
|
31
|
+
user.ensure_authentication_token!
|
32
|
+
user.confirm!
|
33
|
+
authenticated_user = User.find_for_token_authentication(:auth_token => user.authentication_token.reverse)
|
34
|
+
assert_nil authenticated_user
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ValidatableTest < ActiveSupport::TestCase
|
4
|
+
test 'should require email to be set' do
|
5
|
+
user = new_user(:email => nil)
|
6
|
+
assert user.invalid?
|
7
|
+
assert user.errors[:email]
|
8
|
+
assert_equal 'can\'t be blank', user.errors[:email].join
|
9
|
+
end
|
10
|
+
|
11
|
+
test 'should require uniqueness of email, allowing blank' do
|
12
|
+
existing_user = create_user
|
13
|
+
|
14
|
+
user = new_user(:email => '')
|
15
|
+
assert user.invalid?
|
16
|
+
assert_not_equal 'has already been taken', user.errors[:email].join
|
17
|
+
|
18
|
+
user.email = existing_user.email
|
19
|
+
assert user.invalid?
|
20
|
+
assert_equal 'has already been taken', user.errors[:email].join
|
21
|
+
end
|
22
|
+
|
23
|
+
test 'should require correct email format, allowing blank' do
|
24
|
+
user = new_user(:email => '')
|
25
|
+
assert user.invalid?
|
26
|
+
assert_not_equal 'is invalid', user.errors[:email].join
|
27
|
+
|
28
|
+
%w(invalid_email_format email@invalid invalid$character@mail.com other@not 123).each do |email|
|
29
|
+
user.email = email
|
30
|
+
assert user.invalid?, 'should be invalid with email ' << email
|
31
|
+
assert_equal 'is invalid', user.errors[:email].join
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
test 'should accept valid emails' do
|
36
|
+
%w(a.b.c@example.com test_mail@gmail.com any@any.net email@test.br 123@mail.test).each do |email|
|
37
|
+
user = new_user(:email => email)
|
38
|
+
assert user.valid?, 'should be valid with email ' << email
|
39
|
+
assert_blank user.errors[:email]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
test 'should require password to be set when creating a new record' do
|
44
|
+
user = new_user(:password => '', :password_confirmation => '')
|
45
|
+
assert user.invalid?
|
46
|
+
assert_equal 'can\'t be blank', user.errors[:password].join
|
47
|
+
end
|
48
|
+
|
49
|
+
test 'should require confirmation to be set when creating a new record' do
|
50
|
+
user = new_user(:password => 'new_password', :password_confirmation => 'blabla')
|
51
|
+
assert user.invalid?
|
52
|
+
assert_equal 'doesn\'t match confirmation', user.errors[:password].join
|
53
|
+
end
|
54
|
+
|
55
|
+
test 'should require password when updating/reseting password' do
|
56
|
+
user = create_user
|
57
|
+
|
58
|
+
user.password = ''
|
59
|
+
user.password_confirmation = ''
|
60
|
+
|
61
|
+
assert user.invalid?
|
62
|
+
assert_equal 'can\'t be blank', user.errors[:password].join
|
63
|
+
end
|
64
|
+
|
65
|
+
test 'should require confirmation when updating/reseting password' do
|
66
|
+
user = create_user
|
67
|
+
user.password_confirmation = 'another_password'
|
68
|
+
assert user.invalid?
|
69
|
+
assert_equal 'doesn\'t match confirmation', user.errors[:password].join
|
70
|
+
end
|
71
|
+
|
72
|
+
test 'should require a password with minimum of 6 characters' do
|
73
|
+
user = new_user(:password => '12345', :password_confirmation => '12345')
|
74
|
+
assert user.invalid?
|
75
|
+
assert_equal 'is too short (minimum is 6 characters)', user.errors[:password].join
|
76
|
+
end
|
77
|
+
|
78
|
+
test 'should require a password with maximum of 20 characters long' do
|
79
|
+
user = new_user(:password => 'x'*21, :password_confirmation => 'x'*21)
|
80
|
+
assert user.invalid?
|
81
|
+
assert_equal 'is too long (maximum is 20 characters)', user.errors[:password].join
|
82
|
+
end
|
83
|
+
|
84
|
+
test 'should not require password length when it\'s not changed' do
|
85
|
+
user = create_user.reload
|
86
|
+
user.password = user.password_confirmation = nil
|
87
|
+
assert user.valid?
|
88
|
+
|
89
|
+
user.password_confirmation = 'confirmation'
|
90
|
+
assert user.invalid?
|
91
|
+
assert_not (user.errors[:password].join =~ /is too long/)
|
92
|
+
end
|
93
|
+
|
94
|
+
test 'shuold not be included in objects with invalid API' do
|
95
|
+
assert_raise RuntimeError do
|
96
|
+
Class.new.send :include, Devise::Models::Validatable
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
data/test/models_test.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Configurable < User
|
4
|
+
devise :database_authenticatable, :confirmable, :rememberable, :timeoutable, :lockable,
|
5
|
+
:stretches => 15, :pepper => 'abcdef', :confirm_within => 5.days,
|
6
|
+
:remember_for => 7.days, :timeout_in => 15.minutes, :unlock_in => 10.days
|
7
|
+
end
|
8
|
+
|
9
|
+
class Inheritable < Admin
|
10
|
+
end
|
11
|
+
|
12
|
+
class ActiveRecordTest < ActiveSupport::TestCase
|
13
|
+
def include_module?(klass, mod)
|
14
|
+
klass.devise_modules.include?(mod) &&
|
15
|
+
klass.included_modules.include?(Devise::Models::const_get(mod.to_s.classify))
|
16
|
+
end
|
17
|
+
|
18
|
+
def assert_include_modules(klass, *modules)
|
19
|
+
modules.each do |mod|
|
20
|
+
assert include_module?(klass, mod)
|
21
|
+
end
|
22
|
+
|
23
|
+
(Devise::ALL - modules).each do |mod|
|
24
|
+
assert_not include_module?(klass, mod)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
test 'can cherry pick modules' do
|
29
|
+
assert_include_modules Admin, :database_authenticatable, :registerable, :timeoutable, :recoverable, :lockable
|
30
|
+
end
|
31
|
+
|
32
|
+
test 'chosen modules are inheritable' do
|
33
|
+
assert_include_modules Inheritable, :database_authenticatable, :registerable, :timeoutable, :recoverable, :lockable
|
34
|
+
end
|
35
|
+
|
36
|
+
test 'order of module inclusion' do
|
37
|
+
correct_module_order = [:database_authenticatable, :recoverable, :registerable, :lockable, :timeoutable]
|
38
|
+
incorrect_module_order = [:database_authenticatable, :timeoutable, :registerable, :recoverable, :lockable]
|
39
|
+
|
40
|
+
assert_include_modules Admin, *incorrect_module_order
|
41
|
+
|
42
|
+
# get module constants from symbol list
|
43
|
+
module_constants = correct_module_order.collect { |mod| Devise::Models::const_get(mod.to_s.classify) }
|
44
|
+
|
45
|
+
# confirm that they adhere to the order in ALL
|
46
|
+
# get included modules, filter out the noise, and reverse the order
|
47
|
+
assert_equal module_constants, (Admin.included_modules & module_constants).reverse
|
48
|
+
end
|
49
|
+
|
50
|
+
test 'set a default value for stretches' do
|
51
|
+
assert_equal 15, Configurable.stretches
|
52
|
+
end
|
53
|
+
|
54
|
+
test 'set a default value for pepper' do
|
55
|
+
assert_equal 'abcdef', Configurable.pepper
|
56
|
+
end
|
57
|
+
|
58
|
+
test 'set a default value for confirm_within' do
|
59
|
+
assert_equal 5.days, Configurable.confirm_within
|
60
|
+
end
|
61
|
+
|
62
|
+
test 'set a default value for remember_for' do
|
63
|
+
assert_equal 7.days, Configurable.remember_for
|
64
|
+
end
|
65
|
+
|
66
|
+
test 'set a default value for timeout_in' do
|
67
|
+
assert_equal 15.minutes, Configurable.timeout_in
|
68
|
+
end
|
69
|
+
|
70
|
+
test 'set a default value for unlock_in' do
|
71
|
+
assert_equal 10.days, Configurable.unlock_in
|
72
|
+
end
|
73
|
+
|
74
|
+
test 'set null fields on migrations' do
|
75
|
+
Admin.create!
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
ActiveRecord::Migration.verbose = false
|
2
|
+
ActiveRecord::Base.logger = Logger.new(nil)
|
3
|
+
|
4
|
+
ActiveRecord::Migrator.migrate(File.expand_path("../../rails_app/db/migrate/", __FILE__))
|
5
|
+
|
6
|
+
class ActiveSupport::TestCase
|
7
|
+
self.use_transactional_fixtures = true
|
8
|
+
self.use_instantiated_fixtures = false
|
9
|
+
end
|
data/test/orm/mongoid.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
devise :database_authenticatable, :confirmable, :lockable, :recoverable,
|
3
|
+
:registerable, :rememberable, :timeoutable, :token_authenticatable,
|
4
|
+
:trackable, :validatable
|
5
|
+
|
6
|
+
attr_accessible :username, :email, :password, :password_confirmation
|
7
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Filters added to this controller apply to all controllers in the application.
|
2
|
+
# Likewise, all the methods added will be available for all controllers.
|
3
|
+
|
4
|
+
class ApplicationController < ActionController::Base
|
5
|
+
protect_from_forgery
|
6
|
+
|
7
|
+
before_filter :current_user
|
8
|
+
before_filter :authenticate_user!, :if => :devise_controller?
|
9
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class UsersController < ApplicationController
|
2
|
+
before_filter :authenticate_user!, :except => :accept
|
3
|
+
respond_to :html, :xml
|
4
|
+
|
5
|
+
def index
|
6
|
+
user_session[:cart] = "Cart"
|
7
|
+
respond_with(current_user)
|
8
|
+
end
|
9
|
+
|
10
|
+
def accept
|
11
|
+
@current_user = current_user
|
12
|
+
end
|
13
|
+
|
14
|
+
def expire
|
15
|
+
user_session['last_request_at'] = 31.minutes.ago.utc
|
16
|
+
render :text => 'User will be expired on next request'
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Shim
|
2
|
+
extend ::ActiveSupport::Concern
|
3
|
+
include ::Mongoid::Timestamps
|
4
|
+
|
5
|
+
module ClassMethods
|
6
|
+
def last(options={})
|
7
|
+
options.delete(:order) if options[:order] == "id"
|
8
|
+
super(options)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# overwrite equality (because some devise tests use this for asserting model equality)
|
13
|
+
def ==(other)
|
14
|
+
other.is_a?(self.class) && _id == other._id
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class User
|
2
|
+
include Mongoid::Document
|
3
|
+
include Shim
|
4
|
+
|
5
|
+
field :created_at, :type => DateTime
|
6
|
+
|
7
|
+
devise :database_authenticatable, :confirmable, :lockable, :recoverable,
|
8
|
+
:registerable, :rememberable, :timeoutable, :token_authenticatable,
|
9
|
+
:trackable, :validatable
|
10
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "action_controller/railtie"
|
4
|
+
require "action_mailer/railtie"
|
5
|
+
require "active_resource/railtie"
|
6
|
+
require "rails/test_unit/railtie"
|
7
|
+
|
8
|
+
Bundler.require :default, DEVISE_ORM
|
9
|
+
|
10
|
+
begin
|
11
|
+
require "#{DEVISE_ORM}/railtie"
|
12
|
+
rescue LoadError
|
13
|
+
end
|
14
|
+
|
15
|
+
require "devise"
|
16
|
+
|
17
|
+
module RailsApp
|
18
|
+
class Application < Rails::Application
|
19
|
+
# Add additional load paths for your own custom dirs
|
20
|
+
config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers views).include?($1) }
|
21
|
+
config.autoload_paths += [ "#{config.root}/app/#{DEVISE_ORM}" ]
|
22
|
+
|
23
|
+
# Configure generators values. Many other options are available, be sure to check the documentation.
|
24
|
+
# config.generators do |g|
|
25
|
+
# g.orm :active_record
|
26
|
+
# g.template_engine :erb
|
27
|
+
# g.test_framework :test_unit, :fixture => true
|
28
|
+
# end
|
29
|
+
|
30
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
31
|
+
config.filter_parameters << :password
|
32
|
+
|
33
|
+
config.action_mailer.default_url_options = { :host => "localhost:3000" }
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
unless defined?(DEVISE_ORM)
|
2
|
+
DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
|
3
|
+
end
|
4
|
+
|
5
|
+
begin
|
6
|
+
require File.expand_path("../../../../.bundle/environment", __FILE__)
|
7
|
+
rescue LoadError
|
8
|
+
require 'rubygems'
|
9
|
+
require 'bundler'
|
10
|
+
Bundler.setup :default, DEVISE_ORM
|
11
|
+
end
|
12
|
+
|
13
|
+
$:.unshift File.expand_path('../../../../lib', __FILE__)
|