Sha256: 938e9597b3edba2307257d9ed779bc1baa60b609c2941a37182b509ef32145d3

Contents?: true

Size: 598 Bytes

Versions: 9

Compression:

Stored size: 598 Bytes

Contents

require 'active_support/concern'

module Georgia
  module Concerns
    module Publishable
      extend ActiveSupport::Concern

      included do

        scope :published, where(public: true)

        def publish
          self.update_attribute(:public, true)
        end

        def unpublish
          self.update_attribute(:public, false)
        end

        def public?
          self.public
        end
        alias_method :published?, :public?

        def publish_state
          public? ? 'public' : 'private'
        end

      end

      module ClassMethods
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
georgia-0.7.8 app/models/georgia/concerns/publishable.rb
georgia-0.7.7 app/models/georgia/concerns/publishable.rb
georgia-0.7.6 app/models/georgia/concerns/publishable.rb
georgia-0.7.5 app/models/georgia/concerns/publishable.rb
georgia-0.7.4 app/models/georgia/concerns/publishable.rb
georgia-0.7.3 app/models/georgia/concerns/publishable.rb
georgia-0.7.2 app/models/georgia/concerns/publishable.rb
georgia-0.7.1 app/models/georgia/concerns/publishable.rb
georgia-0.7.0 app/models/georgia/concerns/publishable.rb