polivalente 0.1.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -1
- data/app/assets/images/polivalente/user-sample.jpg +0 -0
- data/app/controllers/polivalente/application_controller.rb +1 -1
- data/app/controllers/polivalente/autocomplete_controller.rb +23 -0
- data/app/controllers/polivalente/ping_controller.rb +7 -0
- data/app/helpers/polivalente/color_helper.rb +10 -0
- data/app/helpers/polivalente/enum_helper.rb +17 -0
- data/app/helpers/polivalente/gravatar_helper.rb +33 -0
- data/app/helpers/polivalente/tags_helper.rb +32 -0
- data/app/jobs/polivalente/clean_trash_job.rb +10 -0
- data/app/models/concerns/polivalente/archivable.rb +9 -0
- data/app/models/concerns/polivalente/archiver.rb +11 -0
- data/app/models/concerns/polivalente/commentable.rb +16 -0
- data/app/models/concerns/polivalente/commentator.rb +13 -0
- data/app/models/concerns/polivalente/content_hashable.rb +29 -0
- data/app/models/concerns/polivalente/reactable.rb +19 -0
- data/app/models/concerns/polivalente/reactor.rb +13 -0
- data/app/models/concerns/polivalente/sortable.rb +15 -0
- data/app/models/concerns/polivalente/taggable.rb +40 -0
- data/app/models/concerns/polivalente/trashable.rb +27 -0
- data/app/models/concerns/polivalente/trasher.rb +13 -0
- data/app/models/concerns/polivalente/user_owned.rb +15 -0
- data/app/models/concerns/polivalente/visibility.rb +24 -0
- data/app/models/polivalente/archive.rb +20 -0
- data/app/models/polivalente/comment.rb +26 -0
- data/app/models/polivalente/reaction.rb +24 -0
- data/app/models/polivalente/tag.rb +20 -0
- data/app/models/polivalente/tagging.rb +12 -0
- data/app/models/polivalente/trash.rb +32 -0
- data/app/serializers/polivalente/comment_serializer.rb +8 -0
- data/app/serializers/polivalente/reaction_serializer.rb +7 -0
- data/app/serializers/polivalente/tag_serializer.rb +6 -0
- data/app/serializers/polivalente/tagging_serializer.rb +7 -0
- data/app/serializers/polivalente/user_serializer.rb +9 -0
- data/config/locales/en.yml +79 -0
- data/config/locales/es.yml +111 -0
- data/config/locales/fr.yml +111 -0
- data/config/locales/pt.yml +111 -0
- data/config/routes.rb +7 -1
- data/db/migrate/20220124153504_create_users.rb +1 -2
- data/db/migrate/20220125040905_create_tags.rb +9 -0
- data/db/migrate/20220125040916_create_taggings.rb +12 -0
- data/db/migrate/20220125040920_create_active_storage_tables.active_storage.rb +36 -0
- data/db/migrate/20220125040921_create_action_mailbox_tables.action_mailbox.rb +14 -0
- data/db/migrate/20220125040922_create_action_text_tables.action_text.rb +14 -0
- data/db/migrate/20220125044901_create_comments.rb +13 -0
- data/db/migrate/20220125144339_create_reactions.rb +14 -0
- data/db/migrate/20220125144342_create_trash.rb +12 -0
- data/db/migrate/20220130033524_create_archives.rb +12 -0
- data/lib/generators/polivalente/install/install_generator.rb +37 -0
- data/lib/generators/polivalente/templates/README +10 -0
- data/lib/generators/polivalente/templates/active_model_serializers.rb +1 -0
- data/lib/generators/polivalente/templates/polivalente.rb +20 -0
- data/lib/generators/polivalente/templates/user.rb +61 -0
- data/lib/generators/polivalente/user/user_generator.rb +11 -0
- data/lib/generators/rails/concern/USAGE +10 -0
- data/lib/generators/rails/concern/concern_generator.rb +7 -0
- data/lib/generators/rails/concern/templates/concern.rb +6 -0
- data/lib/generators/rails/stimulus/USAGE +9 -0
- data/lib/generators/rails/stimulus/stimulus_generator.rb +14 -0
- data/lib/generators/rails/stimulus/templates/controller.js +17 -0
- data/lib/generators/rails/validator/USAGE +8 -0
- data/lib/generators/rails/validator/templates/validator.rb +5 -0
- data/lib/generators/rails/validator/validator_generator.rb +7 -0
- data/lib/polivalente/configuration.rb +11 -0
- data/lib/polivalente/engine.rb +19 -0
- data/lib/polivalente/user_locale.rb +24 -0
- data/lib/polivalente/version.rb +1 -1
- data/lib/polivalente.rb +19 -6
- metadata +108 -6
- data/app/models/polivalente/user.rb +0 -20
- data/config/initializers/devise.rb +0 -311
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Polivalente.configure do |config|
|
4
|
+
# ==> User configuration
|
5
|
+
config.user_class = "::User"
|
6
|
+
|
7
|
+
# ==> Controller configuration
|
8
|
+
config.base_controller = "::ApplicationController"
|
9
|
+
config.base_api_controller = "::ApplicationController"
|
10
|
+
|
11
|
+
# ==> Account configuration
|
12
|
+
config.inactive_account_ttl = 60.days
|
13
|
+
config.spam_account_ttl = 4.days
|
14
|
+
|
15
|
+
# ==> Locales configuration
|
16
|
+
config.supported_locales = [:en]
|
17
|
+
|
18
|
+
# ==> Trash configuration
|
19
|
+
config.trash_ttl = 30.days
|
20
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class User < ApplicationRecord
|
4
|
+
include Polivalente::Archiver
|
5
|
+
include Polivalente::Commentator
|
6
|
+
include Polivalente::Reactor
|
7
|
+
include Polivalente::Sortable
|
8
|
+
include Polivalente::Trasher
|
9
|
+
|
10
|
+
# Include default devise modules. Others available are:
|
11
|
+
# :registerable, :validatable,
|
12
|
+
# :timeoutable, and :omniauthable
|
13
|
+
|
14
|
+
devise :database_authenticatable,
|
15
|
+
:confirmable,
|
16
|
+
:rememberable,
|
17
|
+
:recoverable,
|
18
|
+
:lockable,
|
19
|
+
:trackable
|
20
|
+
|
21
|
+
has_one_attached :photo
|
22
|
+
|
23
|
+
validates_length_of :first_name, minimum: 2, maximum: 20
|
24
|
+
validates_length_of :last_name, minimum: 2, maximum: 20
|
25
|
+
validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }
|
26
|
+
validates_uniqueness_of :email
|
27
|
+
validates_length_of :password, minimum: 8
|
28
|
+
|
29
|
+
# A user account is considered spam/abandoned if:
|
30
|
+
# - The account has existed for at least N days
|
31
|
+
# - The account was never confirmed/activated
|
32
|
+
# - The the user never signed in to their account
|
33
|
+
#
|
34
|
+
# These records should be deleted from the database periodically
|
35
|
+
scope :spam, -> {
|
36
|
+
where("created_at <= ? AND sign_in_count <= 1 AND confirmed_at IS NULL", Time.zone.now - spam_account_ttl)
|
37
|
+
}
|
38
|
+
|
39
|
+
# A user account is inactive if:
|
40
|
+
# - The account has not been signed in to for more than X days
|
41
|
+
# These users should be notified about their account state
|
42
|
+
scope :inactive, -> {
|
43
|
+
where("current_sign_in_at <= ?", Time.zone.now - inactive_account_ttl)
|
44
|
+
}
|
45
|
+
|
46
|
+
scope :unconfirmed, -> { where(:confirmed_at => nil)}
|
47
|
+
|
48
|
+
def name
|
49
|
+
"#{first_name} #{last_name}"
|
50
|
+
end
|
51
|
+
|
52
|
+
module ClassMethods
|
53
|
+
def inactive_account_ttl
|
54
|
+
Polivalente.config.inactive_account_ttl.days
|
55
|
+
end
|
56
|
+
|
57
|
+
def spam_account_ttl
|
58
|
+
Polivalente.config.spam_account_ttl.days
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Description:
|
2
|
+
Stubs out a new Stimulus controller.
|
3
|
+
|
4
|
+
This generator accepts one argument, the name of the controller, CamelCased or under_scored.
|
5
|
+
|
6
|
+
Example:
|
7
|
+
`rails generate stimulus Thing`
|
8
|
+
|
9
|
+
This will create a new Stimulus controller at `app/javascript/controllers/thing_controller.js`
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class StimulusGenerator < Rails::Generators::NamedBase
|
2
|
+
# Source: https://github.com/DavidColby/rails-stimulus-generator
|
3
|
+
source_root File.expand_path('templates', __dir__)
|
4
|
+
|
5
|
+
check_class_collision suffix: "Controller"
|
6
|
+
|
7
|
+
def create_controller_directory
|
8
|
+
empty_directory("app/javascript/controllers") unless File.directory?("app/javascript/controllers")
|
9
|
+
end
|
10
|
+
|
11
|
+
def create_controller
|
12
|
+
template("controller.js", File.join("app/javascript/controllers/#{file_name}_controller.js"))
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { Controller } from 'stimulus'
|
2
|
+
|
3
|
+
export default class extends Controller {
|
4
|
+
static targets = []
|
5
|
+
|
6
|
+
initialize() {
|
7
|
+
// Called once, when the controller is first instantiated
|
8
|
+
}
|
9
|
+
|
10
|
+
connect() {
|
11
|
+
// Called any time the controller is connected to the DOM
|
12
|
+
}
|
13
|
+
|
14
|
+
disconnect() {
|
15
|
+
// Called any time the controller is disconnected from the DOM
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Polivalente
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :base_controller
|
4
|
+
attr_accessor :base_api_controller
|
5
|
+
attr_accessor :inactive_account_ttl
|
6
|
+
attr_accessor :spam_account_ttl
|
7
|
+
attr_accessor :supported_locales
|
8
|
+
attr_accessor :trash_ttl
|
9
|
+
attr_accessor :user_class
|
10
|
+
end
|
11
|
+
end
|
data/lib/polivalente/engine.rb
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
module Polivalente
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
isolate_namespace Polivalente
|
4
|
+
|
5
|
+
config.generators do |g|
|
6
|
+
g.scaffold_stylesheet false
|
7
|
+
g.assets false
|
8
|
+
g.test_framework :rspec
|
9
|
+
g.fixture_replacement :factory_bot
|
10
|
+
g.factory_bot dir: "spec/factories"
|
11
|
+
end
|
12
|
+
|
13
|
+
# Loads engine helpers in main application
|
14
|
+
initializer "local_helper.action_controller" do
|
15
|
+
ActiveSupport.on_load :action_controller do
|
16
|
+
helper Polivalente::Engine.helpers
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Do not prefix table names with `polivantente_`
|
21
|
+
def self.table_name_prefix
|
22
|
+
end
|
4
23
|
end
|
5
24
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Polivalente
|
2
|
+
module UserLocale
|
3
|
+
|
4
|
+
protected
|
5
|
+
|
6
|
+
def set_user_locale!
|
7
|
+
@user_locale ||= params[:locale] ||
|
8
|
+
session[:locale] ||
|
9
|
+
extracted_locale_from_header ||
|
10
|
+
I18n.default_locale
|
11
|
+
|
12
|
+
I18n.locale = @user_locale
|
13
|
+
|
14
|
+
rescue I18n::InvalidLocale
|
15
|
+
I18n.locale = @user_locale = I18n.default_locale
|
16
|
+
end
|
17
|
+
|
18
|
+
def extracted_locale_from_header
|
19
|
+
request.headers['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]/).first.to_sym
|
20
|
+
rescue NoMethodError
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/polivalente/version.rb
CHANGED
data/lib/polivalente.rb
CHANGED
@@ -1,18 +1,31 @@
|
|
1
1
|
require "polivalente/version"
|
2
2
|
require "polivalente/railtie"
|
3
3
|
require "polivalente/engine"
|
4
|
+
require "polivalente/configuration"
|
5
|
+
|
6
|
+
# Third-party
|
7
|
+
|
8
|
+
require "active_model_serializers"
|
4
9
|
require "devise"
|
10
|
+
require "discard"
|
5
11
|
|
6
12
|
module Polivalente
|
7
|
-
|
13
|
+
class << self
|
14
|
+
attr_reader :config
|
15
|
+
|
16
|
+
def configure
|
17
|
+
@config = Configuration.new
|
18
|
+
yield config
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
# Modules
|
24
|
+
autoload :UserLocale, "polivalente/user_locale"
|
8
25
|
|
9
26
|
# Configuration
|
10
27
|
|
28
|
+
# do not prefix table names with `polivantente_`
|
11
29
|
def self.table_name_prefix
|
12
|
-
# do not prefix table names with `polivantente_`
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.setup
|
16
|
-
yield self
|
17
30
|
end
|
18
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polivalente
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leo Neto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '7.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: active_model_serializers
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.10'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.10'
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: devise
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,6 +58,20 @@ dependencies:
|
|
44
58
|
- - "~>"
|
45
59
|
- !ruby/object:Gem::Version
|
46
60
|
version: '4.8'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: discard
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.2'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '1.2'
|
47
75
|
- !ruby/object:Gem::Dependency
|
48
76
|
name: factory_bot_rails
|
49
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,6 +86,20 @@ dependencies:
|
|
58
86
|
- - "~>"
|
59
87
|
- !ruby/object:Gem::Version
|
60
88
|
version: '6.2'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: faker
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '2.19'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '2.19'
|
61
103
|
- !ruby/object:Gem::Dependency
|
62
104
|
name: rspec-rails
|
63
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,7 +114,7 @@ dependencies:
|
|
72
114
|
- - "~>"
|
73
115
|
- !ruby/object:Gem::Version
|
74
116
|
version: '5.0'
|
75
|
-
description: Reusable generic features
|
117
|
+
description: Reusable generic features for Rails applications
|
76
118
|
email:
|
77
119
|
- leo@ekletik.com
|
78
120
|
executables: []
|
@@ -83,21 +125,81 @@ files:
|
|
83
125
|
- README.md
|
84
126
|
- Rakefile
|
85
127
|
- app/assets/config/polivalente_manifest.js
|
128
|
+
- app/assets/images/polivalente/user-sample.jpg
|
86
129
|
- app/assets/stylesheets/polivalente/application.css
|
87
130
|
- app/controllers/polivalente/application_controller.rb
|
131
|
+
- app/controllers/polivalente/autocomplete_controller.rb
|
132
|
+
- app/controllers/polivalente/ping_controller.rb
|
88
133
|
- app/helpers/polivalente/application_helper.rb
|
134
|
+
- app/helpers/polivalente/color_helper.rb
|
135
|
+
- app/helpers/polivalente/enum_helper.rb
|
136
|
+
- app/helpers/polivalente/gravatar_helper.rb
|
137
|
+
- app/helpers/polivalente/tags_helper.rb
|
89
138
|
- app/jobs/polivalente/application_job.rb
|
139
|
+
- app/jobs/polivalente/clean_trash_job.rb
|
90
140
|
- app/mailers/polivalente/application_mailer.rb
|
141
|
+
- app/models/concerns/polivalente/archivable.rb
|
142
|
+
- app/models/concerns/polivalente/archiver.rb
|
143
|
+
- app/models/concerns/polivalente/commentable.rb
|
144
|
+
- app/models/concerns/polivalente/commentator.rb
|
145
|
+
- app/models/concerns/polivalente/content_hashable.rb
|
146
|
+
- app/models/concerns/polivalente/reactable.rb
|
147
|
+
- app/models/concerns/polivalente/reactor.rb
|
148
|
+
- app/models/concerns/polivalente/sortable.rb
|
149
|
+
- app/models/concerns/polivalente/taggable.rb
|
150
|
+
- app/models/concerns/polivalente/trashable.rb
|
151
|
+
- app/models/concerns/polivalente/trasher.rb
|
152
|
+
- app/models/concerns/polivalente/user_owned.rb
|
153
|
+
- app/models/concerns/polivalente/visibility.rb
|
91
154
|
- app/models/polivalente/application_record.rb
|
92
|
-
- app/models/polivalente/
|
155
|
+
- app/models/polivalente/archive.rb
|
156
|
+
- app/models/polivalente/comment.rb
|
157
|
+
- app/models/polivalente/reaction.rb
|
158
|
+
- app/models/polivalente/tag.rb
|
159
|
+
- app/models/polivalente/tagging.rb
|
160
|
+
- app/models/polivalente/trash.rb
|
161
|
+
- app/serializers/polivalente/comment_serializer.rb
|
162
|
+
- app/serializers/polivalente/reaction_serializer.rb
|
163
|
+
- app/serializers/polivalente/tag_serializer.rb
|
164
|
+
- app/serializers/polivalente/tagging_serializer.rb
|
165
|
+
- app/serializers/polivalente/user_serializer.rb
|
93
166
|
- app/views/layouts/polivalente/application.html.erb
|
94
|
-
- config/initializers/devise.rb
|
95
167
|
- config/locales/devise.en.yml
|
168
|
+
- config/locales/en.yml
|
169
|
+
- config/locales/es.yml
|
170
|
+
- config/locales/fr.yml
|
171
|
+
- config/locales/pt.yml
|
96
172
|
- config/routes.rb
|
97
173
|
- db/migrate/20220124153504_create_users.rb
|
174
|
+
- db/migrate/20220125040905_create_tags.rb
|
175
|
+
- db/migrate/20220125040916_create_taggings.rb
|
176
|
+
- db/migrate/20220125040920_create_active_storage_tables.active_storage.rb
|
177
|
+
- db/migrate/20220125040921_create_action_mailbox_tables.action_mailbox.rb
|
178
|
+
- db/migrate/20220125040922_create_action_text_tables.action_text.rb
|
179
|
+
- db/migrate/20220125044901_create_comments.rb
|
180
|
+
- db/migrate/20220125144339_create_reactions.rb
|
181
|
+
- db/migrate/20220125144342_create_trash.rb
|
182
|
+
- db/migrate/20220130033524_create_archives.rb
|
183
|
+
- lib/generators/polivalente/install/install_generator.rb
|
184
|
+
- lib/generators/polivalente/templates/README
|
185
|
+
- lib/generators/polivalente/templates/active_model_serializers.rb
|
186
|
+
- lib/generators/polivalente/templates/polivalente.rb
|
187
|
+
- lib/generators/polivalente/templates/user.rb
|
188
|
+
- lib/generators/polivalente/user/user_generator.rb
|
189
|
+
- lib/generators/rails/concern/USAGE
|
190
|
+
- lib/generators/rails/concern/concern_generator.rb
|
191
|
+
- lib/generators/rails/concern/templates/concern.rb
|
192
|
+
- lib/generators/rails/stimulus/USAGE
|
193
|
+
- lib/generators/rails/stimulus/stimulus_generator.rb
|
194
|
+
- lib/generators/rails/stimulus/templates/controller.js
|
195
|
+
- lib/generators/rails/validator/USAGE
|
196
|
+
- lib/generators/rails/validator/templates/validator.rb
|
197
|
+
- lib/generators/rails/validator/validator_generator.rb
|
98
198
|
- lib/polivalente.rb
|
199
|
+
- lib/polivalente/configuration.rb
|
99
200
|
- lib/polivalente/engine.rb
|
100
201
|
- lib/polivalente/railtie.rb
|
202
|
+
- lib/polivalente/user_locale.rb
|
101
203
|
- lib/polivalente/version.rb
|
102
204
|
- lib/tasks/polivalente_tasks.rake
|
103
205
|
homepage: https://github.com/oleoneto/polivalente
|
@@ -106,7 +208,7 @@ licenses:
|
|
106
208
|
metadata:
|
107
209
|
homepage_uri: https://github.com/oleoneto/polivalente
|
108
210
|
source_code_uri: https://github.com/oleoneto/polivalente
|
109
|
-
changelog_uri: https://github.com/oleoneto/polivalente/blob/
|
211
|
+
changelog_uri: https://github.com/oleoneto/polivalente/blob/main/CHANGELOG.md
|
110
212
|
post_install_message:
|
111
213
|
rdoc_options: []
|
112
214
|
require_paths:
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Polivalente
|
2
|
-
class User < ApplicationRecord
|
3
|
-
# Include default devise modules. Others available are:
|
4
|
-
# :registerable, :validatable,
|
5
|
-
# :timeoutable, and :omniauthable
|
6
|
-
|
7
|
-
devise :database_authenticatable,
|
8
|
-
:confirmable,
|
9
|
-
:rememberable,
|
10
|
-
:recoverable,
|
11
|
-
:lockable,
|
12
|
-
:trackable
|
13
|
-
|
14
|
-
validates_length_of :first_name, minimum: 2, maximum: 20
|
15
|
-
validates_length_of :last_name, minimum: 2, maximum: 20
|
16
|
-
validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }
|
17
|
-
validates_uniqueness_of :email
|
18
|
-
validates_length_of :password, minimum: 8
|
19
|
-
end
|
20
|
-
end
|