Skip to content

Commit 71a142d

Browse files
authored
Merge branch 'dev' into feature/github-integration
2 parents 96f0560 + dbaec3b commit 71a142d

File tree

4 files changed

+10
-20
lines changed

4 files changed

+10
-20
lines changed

app/models/better_together/post.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
module BetterTogether
44
# Represents a blog post
55
class Post < ApplicationRecord
6-
PRIVACY_LEVELS = {
7-
private: 'private',
8-
public: 'public'
9-
}.freeze
10-
116
include Authorable
127
include FriendlySlug
138
include Categorizable
@@ -22,9 +17,6 @@ class Post < ApplicationRecord
2217

2318
slugged :title
2419

25-
enum post_privacy: PRIVACY_LEVELS,
26-
_prefix: :post_privacy
27-
2820
validates :title,
2921
presence: true
3022

app/models/concerns/better_together/author.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ module Author
77

88
included do
99
has_many :authorships,
10-
as: :author
11-
has_many :authorables,
12-
through: :authorships
10+
foreign_key: :author_id
11+
has_many :authored_pages,
12+
through: :authorships,
13+
source: :authorable,
14+
source_type: 'BetterTogether::Page'
15+
has_many :authored_posts,
16+
through: :authorships,
17+
source: :authorable,
18+
source_type: 'BetterTogether::Post'
1319
end
1420
end
1521
end

app/models/concerns/better_together/authorable.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module Authorable
77

88
included do
99
has_many :authorships,
10+
-> { positioned },
1011
as: :authorable
1112
has_many :authors,
1213
through: :authorships

spec/dummy/db/schema.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,6 @@
100100
t.index ["target_locale"], name: "index_better_together_ai_log_translations_on_target_locale"
101101
end
102102

103-
create_table "better_together_authors", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
104-
t.integer "lock_version", default: 0, null: false
105-
t.datetime "created_at", null: false
106-
t.datetime "updated_at", null: false
107-
t.string "author_type", null: false
108-
t.uuid "author_id", null: false
109-
t.index ["author_type", "author_id"], name: "by_author", unique: true
110-
end
111-
112103
create_table "better_together_authorships", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
113104
t.integer "lock_version", default: 0, null: false
114105
t.datetime "created_at", null: false

0 commit comments

Comments
 (0)