arkaan 2.8.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arkaan.rb +18 -16
- data/lib/arkaan/account.rb +22 -19
- data/lib/arkaan/authentication.rb +3 -1
- data/lib/arkaan/authentication/session.rb +10 -7
- data/lib/arkaan/campaign.rb +21 -19
- data/lib/arkaan/campaigns.rb +4 -2
- data/lib/arkaan/campaigns/invitation.rb +2 -2
- data/lib/arkaan/chatrooms.rb +7 -5
- data/lib/arkaan/chatrooms/base.rb +3 -1
- data/lib/arkaan/chatrooms/campaign.rb +3 -1
- data/lib/arkaan/chatrooms/conversation.rb +5 -1
- data/lib/arkaan/chatrooms/membership.rb +6 -2
- data/lib/arkaan/chatrooms/message.rb +5 -3
- data/lib/arkaan/concerns.rb +10 -8
- data/lib/arkaan/concerns/activable.rb +6 -4
- data/lib/arkaan/concerns/diagnosticable.rb +7 -5
- data/lib/arkaan/concerns/enumerable.rb +21 -9
- data/lib/arkaan/concerns/historizable.rb +7 -5
- data/lib/arkaan/concerns/mime_typable.rb +18 -10
- data/lib/arkaan/concerns/premiumable.rb +3 -1
- data/lib/arkaan/concerns/sluggable.rb +9 -8
- data/lib/arkaan/concerns/typable.rb +5 -3
- data/lib/arkaan/factories.rb +4 -2
- data/lib/arkaan/files.rb +6 -2
- data/lib/arkaan/files/document.rb +5 -3
- data/lib/arkaan/files/permission.rb +4 -2
- data/lib/arkaan/monitoring.rb +4 -2
- data/lib/arkaan/monitoring/route.rb +6 -3
- data/lib/arkaan/monitoring/service.rb +5 -3
- data/lib/arkaan/notification.rb +5 -2
- data/lib/arkaan/oauth.rb +6 -4
- data/lib/arkaan/oauth/access_token.rb +10 -8
- data/lib/arkaan/oauth/application.rb +17 -11
- data/lib/arkaan/oauth/authorization.rb +8 -6
- data/lib/arkaan/oauth/refresh_token.rb +7 -4
- data/lib/arkaan/permissions.rb +5 -3
- data/lib/arkaan/permissions/category.rb +4 -2
- data/lib/arkaan/permissions/group.rb +4 -2
- data/lib/arkaan/permissions/right.rb +8 -4
- data/lib/arkaan/ruleset.rb +6 -4
- metadata +2 -8
- data/lib/arkaan/decorators/errors.rb +0 -9
- data/lib/arkaan/decorators/errors/env_variable_missing.rb +0 -14
- data/lib/arkaan/decorators/gateway.rb +0 -109
- data/lib/arkaan/factories/errors.rb +0 -9
- data/lib/arkaan/factories/errors/gateway_not_found.rb +0 -14
- data/lib/arkaan/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99aa03dc8a6f14cf981a81b89ab54adf9450c7bf2646a8231883ec71673d5695
|
4
|
+
data.tar.gz: 1e852dcc77ae4418286c94b7390888b3f8e71c57770852548cdf585ec300cea8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fb7d81811559f1daff3971c65b80d323ad9c29705e96b5cc3d6ba2729234498b094955e76478148c3876b2aeb62f6dad5806d34f6fae6761d0fecb86d495917
|
7
|
+
data.tar.gz: 4d2398bdc636a6b2307d4d4c101cf7f75e0e74b958f13e1d37d7e22addbbbfaec96022565737212c9f7b4beacd8f94e4f956f73a43203ca057612c8f50b33683
|
data/lib/arkaan.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'mongoid'
|
2
4
|
require 'active_model'
|
3
5
|
require 'active_support'
|
@@ -6,20 +8,20 @@ require 'dotenv/load'
|
|
6
8
|
# Main module of the application, holding all the subsequent classes.
|
7
9
|
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
8
10
|
module Arkaan
|
9
|
-
autoload :Account
|
11
|
+
autoload :Account, 'arkaan/account'
|
10
12
|
autoload :Authentication, 'arkaan/authentication'
|
11
|
-
autoload :Campaign
|
12
|
-
autoload :Campaigns
|
13
|
-
autoload :Chatroom
|
14
|
-
autoload :Chatrooms
|
15
|
-
autoload :Concerns
|
16
|
-
autoload :Event
|
17
|
-
autoload :Factories
|
18
|
-
autoload :Files
|
19
|
-
autoload :Monitoring
|
20
|
-
autoload :Notification
|
21
|
-
autoload :OAuth
|
22
|
-
autoload :Permissions
|
23
|
-
autoload :Phone
|
24
|
-
autoload :Ruleset
|
25
|
-
end
|
13
|
+
autoload :Campaign, 'arkaan/campaign'
|
14
|
+
autoload :Campaigns, 'arkaan/campaigns'
|
15
|
+
autoload :Chatroom, 'arkaan/chatroom'
|
16
|
+
autoload :Chatrooms, 'arkaan/chatrooms'
|
17
|
+
autoload :Concerns, 'arkaan/concerns'
|
18
|
+
autoload :Event, 'arkaan/event'
|
19
|
+
autoload :Factories, 'arkaan/factories'
|
20
|
+
autoload :Files, 'arkaan/files'
|
21
|
+
autoload :Monitoring, 'arkaan/monitoring'
|
22
|
+
autoload :Notification, 'arkaan/notification'
|
23
|
+
autoload :OAuth, 'arkaan/oauth'
|
24
|
+
autoload :Permissions, 'arkaan/permissions'
|
25
|
+
autoload :Phone, 'arkaan/phone'
|
26
|
+
autoload :Ruleset, 'arkaan/ruleset'
|
27
|
+
end
|
data/lib/arkaan/account.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arkaan
|
2
4
|
# A user account with all related attributes. It holds credentials and informations about a designated user.
|
3
5
|
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
@@ -8,7 +10,7 @@ module Arkaan
|
|
8
10
|
include Arkaan::Concerns::Enumerable
|
9
11
|
|
10
12
|
# @!attribute [rw] username
|
11
|
-
# @return [String] the
|
13
|
+
# @return [String] the current name identifying the user on the GUI.
|
12
14
|
field :username, type: String
|
13
15
|
# @!attribute [r] password_digest
|
14
16
|
# @return [String] the password of the user, encrypted with the Blowfish algorithm.
|
@@ -20,30 +22,31 @@ module Arkaan
|
|
20
22
|
# @return [String] the first name of the user.
|
21
23
|
field :firstname, type: String, default: ''
|
22
24
|
# @!attribute [rw] email
|
23
|
-
# @return [String] the email address of the user, useful to contact them
|
25
|
+
# @return [String] the email address of the user, useful to contact them.
|
24
26
|
field :email, type: String
|
25
27
|
# @!attribute [rw] language
|
26
28
|
# @return [Symbol] the language preferred by this user.
|
27
|
-
enum_field :language, [
|
29
|
+
enum_field :language, %i[en_GB fr_FR], default: :fr_FR
|
28
30
|
# @!attribute [rw] gender
|
29
31
|
# @return [Symbol] the way you prefer the application to gender you.
|
30
|
-
enum_field :gender, [
|
32
|
+
enum_field :gender, %i[female male neutral], default: :neutral
|
31
33
|
|
32
34
|
# @!attribute [w] password
|
33
|
-
# @return [String] password, in clear, of the user
|
35
|
+
# @return [String] password, in clear, of the user if you just changed it.
|
34
36
|
# @!attribute [w] password_confirmation
|
35
|
-
# @return [String] the confirmation of the password,
|
37
|
+
# @return [String] the confirmation of the password, that matches the password itself.
|
36
38
|
has_secure_password validations: false
|
37
39
|
|
38
40
|
# @!attribute [rw] groups
|
39
41
|
# @return [Array<Arkaan::Permissions::Group>] the groups giving their corresponding rights to the current account.
|
40
42
|
has_and_belongs_to_many :groups, class_name: 'Arkaan::Permissions::Group', inverse_of: :accounts
|
41
|
-
|
43
|
+
|
42
44
|
# @!attribute [rw] applications
|
43
45
|
# @return [Array<Arkaan::OAuth::Application] the applications this user has created and owns.
|
44
46
|
has_many :applications, class_name: 'Arkaan::OAuth::Application', inverse_of: :creator
|
45
47
|
# @!attribute [rw] authorizations
|
46
|
-
# @return [Array<Arkaan::OAuth::Authorization>] the authorization issued by this account
|
48
|
+
# @return [Array<Arkaan::OAuth::Authorization>] the authorization issued by this account
|
49
|
+
# to third-party applications to access its data.
|
47
50
|
has_many :authorizations, class_name: 'Arkaan::OAuth::Authorization', inverse_of: :account
|
48
51
|
# @!attribute [rw] services
|
49
52
|
# @return [Array<Arkaan::Monitoring::Service>] the services created by this user.
|
@@ -75,26 +78,26 @@ module Arkaan
|
|
75
78
|
notifications.where(read: false)
|
76
79
|
end
|
77
80
|
|
78
|
-
# @return [Array<Arkaan::Notification>] the notifications already read
|
81
|
+
# @return [Array<Arkaan::Notification>] the notifications already read byt the user.
|
79
82
|
def read_notifications
|
80
83
|
notifications.where(read: true)
|
81
84
|
end
|
82
85
|
|
83
86
|
validates :username,
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
+
presence: { message: 'required' },
|
88
|
+
length: { minimum: 6, message: 'minlength', if: :username? },
|
89
|
+
uniqueness: { message: 'uniq', if: :username? }
|
87
90
|
|
88
91
|
validates :email,
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
+
presence: { message: 'required' },
|
93
|
+
format: { with: /\A[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\z/, message: 'pattern', if: :email? },
|
94
|
+
uniqueness: { message: 'uniq', if: :email? }
|
92
95
|
|
93
96
|
validates :password,
|
94
|
-
|
95
|
-
|
97
|
+
presence: { message: 'required', if: -> { !persisted? || password_digest_changed? } },
|
98
|
+
confirmation: { message: 'confirmation', if: :password_digest_changed? }
|
96
99
|
|
97
100
|
validates :password_confirmation,
|
98
|
-
|
101
|
+
presence: { message: 'required', if: :password_digest_changed? }
|
99
102
|
end
|
100
|
-
end
|
103
|
+
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arkaan
|
2
4
|
# This module holds the logic for user authentication to our frontend.
|
3
5
|
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
4
6
|
module Authentication
|
5
7
|
autoload :Session, 'arkaan/authentication/session'
|
6
8
|
end
|
7
|
-
end
|
9
|
+
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arkaan
|
2
4
|
module Authentication
|
3
5
|
# A session represents the connection of the user on our frontend application. Nobody else than our frontend should
|
4
|
-
# have access to the session or it's content (in particular to the token), instead they shall use
|
6
|
+
# have access to the session or it's content (in particular to the token), instead they shall use OAuth2.0.
|
5
7
|
# A session shall ONLY be created by a premium application (only our frontend applications are premium).
|
6
8
|
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
7
9
|
class Session
|
@@ -9,10 +11,11 @@ module Arkaan
|
|
9
11
|
include Mongoid::Timestamps
|
10
12
|
|
11
13
|
# @!attribute [rw] token
|
12
|
-
# @return [String] the unique token for this session, used to identify it and be sure the user is connected
|
14
|
+
# @return [String] the unique token for this session, used to identify it and be sure the user is connected.
|
13
15
|
field :token, type: String
|
14
16
|
# @!attribute [rw] websocket_id
|
15
|
-
# @return [String] the ID of the websocket
|
17
|
+
# @return [String] the ID of the websocket the user is connected to.
|
18
|
+
# It's not an association because instances are embedded.
|
16
19
|
field :websocket_id, type: String, default: ''
|
17
20
|
|
18
21
|
# @!attribute [rw] account
|
@@ -20,9 +23,9 @@ module Arkaan
|
|
20
23
|
belongs_to :account, class_name: 'Arkaan::Account', inverse_of: :sessions
|
21
24
|
|
22
25
|
validates :token,
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
+
presence: { message: 'required' },
|
27
|
+
uniqueness: { message: 'uniq', if: :token? },
|
28
|
+
length: { minimum: 10, message: 'minlength', if: :token? }
|
26
29
|
end
|
27
30
|
end
|
28
|
-
end
|
31
|
+
end
|
data/lib/arkaan/campaign.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arkaan
|
2
4
|
# A campaign is a gathering of accounts playing on the same interface, and interacting in a common game.
|
3
5
|
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
@@ -12,7 +14,7 @@ module Arkaan
|
|
12
14
|
# @return [String] a more detailed description, used to give further information about the campaign in general.
|
13
15
|
field :description, type: String
|
14
16
|
# @!attribute [rw] is_private
|
15
|
-
# @return [Boolean] TRUE if the campaign can be joined only by being invited by the creator, FALSE if
|
17
|
+
# @return [Boolean] TRUE if the campaign can be joined only by being invited by the creator, FALSE if public.
|
16
18
|
field :is_private, type: Boolean, default: true
|
17
19
|
# @!attribute [rw] tags
|
18
20
|
# @return [Array<String>] an array of tags describing characteristics of this campaign.
|
@@ -37,11 +39,11 @@ module Arkaan
|
|
37
39
|
belongs_to :ruleset, class_name: 'Arkaan::Ruleset', inverse_of: :campaigns, optional: true
|
38
40
|
|
39
41
|
validates :title,
|
40
|
-
|
41
|
-
|
42
|
+
presence: { message: 'required' },
|
43
|
+
length: { minimum: 4, message: 'minlength', if: :title? }
|
42
44
|
|
43
45
|
validates :max_players,
|
44
|
-
|
46
|
+
numericality: { less_than: 21, message: 'maximum' }
|
45
47
|
|
46
48
|
validate :title_unicity
|
47
49
|
|
@@ -50,13 +52,13 @@ module Arkaan
|
|
50
52
|
# Sets the creator of the campaign. This method is mainly used for backward-compatibility needs.
|
51
53
|
# @param account [Arkaan::Account] the account of the creator for this campaign.
|
52
54
|
def creator=(account)
|
53
|
-
if
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
return if invitations.where(account: account).exists?
|
56
|
+
|
57
|
+
Arkaan::Campaigns::Invitation.create(
|
58
|
+
campaign: self,
|
59
|
+
account: account,
|
60
|
+
status: :creator
|
61
|
+
)
|
60
62
|
end
|
61
63
|
|
62
64
|
# Getter for the creator account of this campaign.
|
@@ -71,24 +73,24 @@ module Arkaan
|
|
71
73
|
campaign_ids = creator.invitations.where(:campaign_id.ne => _id).pluck(:campaign_id)
|
72
74
|
# With this list of campaign IDs, we look for a campaign with the same title.
|
73
75
|
same_title_campaign = Arkaan::Campaign.where(:_id.in => campaign_ids, title: title)
|
74
|
-
|
75
|
-
|
76
|
-
|
76
|
+
return unless !creator.nil? && title? && same_title_campaign.exists?
|
77
|
+
|
78
|
+
errors.add(:title, 'uniq')
|
77
79
|
end
|
78
80
|
|
79
81
|
# Validation for the max number of players for a campaign.
|
80
82
|
# If there is a max number of players, and the current number of
|
81
83
|
# players is above it, or the max number of players is 0, raises an error.
|
82
84
|
def max_players_minimum
|
83
|
-
|
84
|
-
|
85
|
-
|
85
|
+
return unless max_players? && (max_players < players_count || max_players < 1)
|
86
|
+
|
87
|
+
errors.add(:max_players, 'minimum')
|
86
88
|
end
|
87
89
|
|
88
90
|
# @return [Array<Arkaan::Campaigns::Invitation>] the players in this campaign.
|
89
91
|
def players
|
90
92
|
invitations.to_a.select do |invitation|
|
91
|
-
[
|
93
|
+
%i[creator accepted].include? invitation.enum_status
|
92
94
|
end
|
93
95
|
end
|
94
96
|
|
@@ -105,4 +107,4 @@ module Arkaan
|
|
105
107
|
self.chatroom = Arkaan::Chatrooms::Campaign.new(campaign: self)
|
106
108
|
end
|
107
109
|
end
|
108
|
-
end
|
110
|
+
end
|
data/lib/arkaan/campaigns.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arkaan
|
2
4
|
# The campaigns module is holding the logic for some objects related to campaigns.
|
3
5
|
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
4
6
|
module Campaigns
|
5
7
|
autoload :Invitation, 'arkaan/campaigns/invitation'
|
6
|
-
autoload :Tag
|
8
|
+
autoload :Tag, 'arkaan/campaigns/tag'
|
7
9
|
end
|
8
|
-
end
|
10
|
+
end
|
@@ -22,8 +22,8 @@ module Arkaan
|
|
22
22
|
# @!attribute [rw] status
|
23
23
|
# @return [Symbol] the current status of the invitation.
|
24
24
|
historize enum_field :status,
|
25
|
-
|
26
|
-
|
25
|
+
%i[pending request accepted refused expelled left master creator],
|
26
|
+
default: :pending
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/lib/arkaan/chatrooms.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arkaan
|
2
4
|
# The chatrooms modules regroup all classes concerning messages between players.
|
3
5
|
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
4
6
|
module Chatrooms
|
5
|
-
autoload :Base
|
6
|
-
autoload :Campaign
|
7
|
+
autoload :Base, 'arkaan/chatrooms/base'
|
8
|
+
autoload :Campaign, 'arkaan/chatrooms/campaign'
|
7
9
|
autoload :Conversation, 'arkaan/chatrooms/conversation'
|
8
|
-
autoload :Message
|
9
|
-
autoload :Membership
|
10
|
+
autoload :Message, 'arkaan/chatrooms/message'
|
11
|
+
autoload :Membership, 'arkaan/chatrooms/membership'
|
10
12
|
end
|
11
|
-
end
|
13
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arkaan
|
2
4
|
module Chatrooms
|
3
5
|
# The base chatroom class, made to be subclassed in campaign and personal chatrooms.
|
@@ -11,4 +13,4 @@ module Arkaan
|
|
11
13
|
has_many :messages, class_name: 'Arkaan::Chatrooms::Message', inverse_of: :chatroom
|
12
14
|
end
|
13
15
|
end
|
14
|
-
end
|
16
|
+
end
|
@@ -1,7 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arkaan
|
2
4
|
module Chatrooms
|
5
|
+
# A conversation is an exchange of messages between several users.
|
6
|
+
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
3
7
|
class Conversation < Arkaan::Chatrooms::Base
|
4
8
|
has_many :memberships, class_name: 'Arkaan::Chatrooms::Membership', inverse_of: :chatroom
|
5
9
|
end
|
6
10
|
end
|
7
|
-
end
|
11
|
+
end
|
@@ -1,15 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arkaan
|
2
4
|
module Chatrooms
|
5
|
+
# A membership is the link between a user and a conversation.
|
6
|
+
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
3
7
|
class Membership
|
4
8
|
include Mongoid::Document
|
5
9
|
include Mongoid::Timestamps
|
6
10
|
include Arkaan::Concerns::Enumerable
|
7
11
|
|
8
|
-
enum_field :status, [
|
12
|
+
enum_field :status, %i[shown hidden], default: :shown
|
9
13
|
|
10
14
|
belongs_to :chatroom, class_name: 'Arkaan::Chatrooms::Private', inverse_of: :memberships
|
11
15
|
|
12
16
|
belongs_to :account, class_name: 'Arkaan::Account', inverse_of: :memberships
|
13
17
|
end
|
14
18
|
end
|
15
|
-
end
|
19
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arkaan
|
2
4
|
module Chatrooms
|
3
5
|
# This model represents an in-game tchat message sent in the tchat of a campaign.
|
@@ -8,8 +10,8 @@ module Arkaan
|
|
8
10
|
include Arkaan::Concerns::Enumerable
|
9
11
|
|
10
12
|
# @!attribute [rw] type
|
11
|
-
# @return [Symbol] the type of message (plain text or command) contained in the data, used to
|
12
|
-
enum_field :type, [
|
13
|
+
# @return [Symbol] the type of message (plain text or command) contained in the data, used to display it.
|
14
|
+
enum_field :type, %i[text command], default: :text
|
13
15
|
# @!attribute [rw] data
|
14
16
|
# @return [Hash] the additional data passed to the message (arguments of the command, or content of the text)
|
15
17
|
field :data, type: Hash, default: {}
|
@@ -28,4 +30,4 @@ module Arkaan
|
|
28
30
|
belongs_to :account, class_name: 'Arkaan::Account', inverse_of: :messages
|
29
31
|
end
|
30
32
|
end
|
31
|
-
end
|
33
|
+
end
|
data/lib/arkaan/concerns.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arkaan
|
2
4
|
# This module holds the shared concerns to include in the desired models.
|
3
5
|
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
4
6
|
module Concerns
|
5
|
-
autoload :Activable
|
7
|
+
autoload :Activable, 'arkaan/concerns/activable'
|
6
8
|
autoload :Diagnosticable, 'arkaan/concerns/diagnosticable'
|
7
|
-
autoload :Enumerable
|
8
|
-
autoload :Historizable
|
9
|
-
autoload :MimeTypable
|
10
|
-
autoload :Premiumable
|
11
|
-
autoload :Sluggable
|
12
|
-
autoload :Typable
|
9
|
+
autoload :Enumerable, 'arkaan/concerns/enumerable'
|
10
|
+
autoload :Historizable, 'arkaan/concerns/historizable'
|
11
|
+
autoload :MimeTypable, 'arkaan/concerns/mime_typable'
|
12
|
+
autoload :Premiumable, 'arkaan/concerns/premiumable'
|
13
|
+
autoload :Sluggable, 'arkaan/concerns/sluggable'
|
14
|
+
autoload :Typable, 'arkaan/concerns/typable'
|
13
15
|
end
|
14
|
-
end
|
16
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arkaan
|
2
4
|
module Concerns
|
3
5
|
# Concerns for the objects that can be activated or deactivated, included the corresponding scopes.
|
@@ -9,10 +11,10 @@ module Arkaan
|
|
9
11
|
# @!attribute [rw] active
|
10
12
|
# @return [Boolean] the active status of the instance, indicating if someone has deactivated it or not.
|
11
13
|
field :active, type: Boolean, default: true
|
12
|
-
|
13
|
-
scope :active
|
14
|
-
scope :inactive, ->{ where(active: false) }
|
14
|
+
|
15
|
+
scope :active, -> { where(active: true) }
|
16
|
+
scope :inactive, -> { where(active: false) }
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
18
|
-
end
|
20
|
+
end
|