Module: WithSlug::ClassMethods
- Defined in:
- app/models/concerns/with_slug.rb
Overview
Filtering
Instance Method Summary collapse
- #allowed(permissions) ⇒ Object
- #by_slug_parts!(args) ⇒ Object
- #locate_resource(key) ⇒ Object
- #visible(permissions) ⇒ Object
Instance Method Details
#allowed(permissions) ⇒ Object
35 36 37 |
# File 'app/models/concerns/with_slug.rb', line 35 def allowed() all.select { |it| &.writer?(it.slug) } end |
#by_slug_parts!(args) ⇒ Object
44 45 46 |
# File 'app/models/concerns/with_slug.rb', line 44 def by_slug_parts!(args) find_by!(slug: "#{args[:organization]}/#{args[:repository]}") end |
#locate_resource(key) ⇒ Object
48 49 50 |
# File 'app/models/concerns/with_slug.rb', line 48 def locate_resource(key) find_or_initialize_by(slug: key) end |
#visible(permissions) ⇒ Object
39 40 41 42 |
# File 'app/models/concerns/with_slug.rb', line 39 def visible() # FIXME no truly generic all.select { |it| !it.private? || &.writer?(it.slug) } end |