Refactor app in to its own slice
This commit is contained in:
19
slices/main/repos/page_repo.rb
Normal file
19
slices/main/repos/page_repo.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
module Main
|
||||
module Repos
|
||||
class PageRepo < Adamantium::Repo[:pages]
|
||||
def fetch!(slug:)
|
||||
pages
|
||||
.published
|
||||
.where(slug: slug).one!
|
||||
end
|
||||
|
||||
def for_main_nav
|
||||
pages
|
||||
.select(:name, :slug, :light_colour, :dark_colour, :published_at)
|
||||
.published
|
||||
.where(main_menu: true)
|
||||
.to_a
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user