Files
adamantium/lib/adamantium/persistence/relations/posts.rb
2023-01-27 22:55:09 +11:00

23 lines
440 B
Ruby

# frozen_string_literal: true
module Adamantium
module Persistence
module Relations
class Posts < ROM::Relation[:sql]
schema :posts, infer: true do
associations do
has_many :post_tags
has_many :tags, through: :post_tags
end
end
auto_struct(true)
def published
where(self[:published_at] <= Time.now)
end
end
end
end
end