Skip to content

Commit d403254

Browse files
committed
Rename Host concert to PlatformHost to reduce confusion and create new HostsEvents concern to set up association to hosted_events through event_hosts
1 parent 5c2cdcb commit d403254

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

app/models/better_together/community.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ module BetterTogether
44
# A gathering
55
class Community < ApplicationRecord
66
include Contactable
7-
include Host
7+
include HostsEvents
88
include Identifier
99
include Infrastructure::BuildingConnections
1010
include Joinable
11+
include Permissible
12+
include PlatformHost
1113
include Protected
1214
include Privacy
13-
include Permissible
1415
include Metrics::Viewable
1516

1617
belongs_to :creator,

app/models/better_together/platform.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module BetterTogether
66
# Represents the host application and it's peers
77
class Platform < ApplicationRecord
8-
include Host
8+
include PlatformHost
99
include Identifier
1010
include Joinable
1111
include Permissible
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
module BetterTogether
4+
# Concern that when included gives the model access to events through event_host records
5+
module HostsEvents
6+
extend ActiveSupport::Concern
7+
8+
included do
9+
has_many :event_hosts, as: :host
10+
has_many :hosted_events, through: :event_hosts, source: :event
11+
end
12+
end
13+
end

app/models/concerns/better_together/host.rb renamed to app/models/concerns/better_together/platform_host.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module BetterTogether
44
# Concern that when included allows model to be set as host
5-
module Host
5+
module PlatformHost
66
extend ActiveSupport::Concern
77

88
included do

0 commit comments

Comments
 (0)