Sha256: e52f03767b68d89aeece88cac5af0f1148260cecc51a203a21b8370347700254

Contents?: true

Size: 665 Bytes

Versions: 73

Compression:

Stored size: 665 Bytes

Contents

# Common methods for single relations, like {Relation::Public} and {Relation::Reject}
#
# Unlike {Relation::Custom}, {SocialStream::Models::Subject subjects} have only one of
# these {Relation relations}.
#
class Relation::Single < Relation
  PERMISSIONS = []

  class << self
    def instance
      @instance ||=
        first ||
          create!(:permissions => permissions)
    end

    def permissions
      self::PERMISSIONS.map{ |p|
        Permission.find_or_create_by_action_and_object p.first, p.last
      }
    end

  end

  # The name of public relation
  def name
    I18n.t("relation_#{ self.class.name.split("::").last.underscore }.name")
  end
end

Version data entries

73 entries across 73 versions & 2 rubygems

Version Path
social_stream-2.1.1 base/app/models/relation/single.rb
social_stream-1.1.12 base/app/models/relation/single.rb
social_stream-base-1.1.11 app/models/relation/single.rb
social_stream-2.1.0 base/app/models/relation/single.rb
social_stream-base-2.1.0 app/models/relation/single.rb
social_stream-2.0.4 base/app/models/relation/single.rb
social_stream-base-2.0.4 app/models/relation/single.rb
social_stream-2.0.3 base/app/models/relation/single.rb
social_stream-base-2.0.3 app/models/relation/single.rb
social_stream-1.1.11 base/app/models/relation/single.rb
social_stream-base-1.1.10 app/models/relation/single.rb
social_stream-1.1.10 base/app/models/relation/single.rb
social_stream-base-1.1.9 app/models/relation/single.rb
social_stream-1.1.9 base/app/models/relation/single.rb
social_stream-base-1.1.8 app/models/relation/single.rb
social_stream-1.1.8 base/app/models/relation/single.rb
social_stream-base-1.1.7 app/models/relation/single.rb
social_stream-2.0.2 base/app/models/relation/single.rb
social_stream-base-2.0.2 app/models/relation/single.rb
social_stream-2.0.1 base/app/models/relation/single.rb