Sha256: 05c7eccd0755dacaef1d141e240b3060920c3f414e3162ac99f2987597272a09

Contents?: true

Size: 224 Bytes

Versions: 94

Compression:

Stored size: 224 Bytes

Contents

module Publishable
  extend ActiveSupport::Concern

  included do
    scope :published, -> { where(published: true) }
  end

  class_methods do
    def visible_to(user)
      user&.admin? ? all : published
    end
  end
end

Version data entries

94 entries across 94 versions & 1 rubygems

Version Path
station-0.1.5 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.1.4 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.1.3 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.1.2 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.1.1 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.1.0 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.145 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.144 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.143 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.142 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.141 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.140 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.139 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.138 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.137 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.136 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.135 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.134 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.133 lib/nexmo_developer/app/models/concerns/publishable.rb
station-0.0.132 lib/nexmo_developer/app/models/concerns/publishable.rb