Class: Relation::Single

Inherits:
Relation
  • Object
show all
Defined in:
app/models/relation/single.rb

Overview

Common methods for single relations, like Public and Reject

Unlike Custom, subjects have only one of these relations.

Direct Known Subclasses

Public, Reject

Constant Summary

Constants inherited from Relation

Negative, Positive

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Relation

allow, allow?, #mode, negative_names, normalize, normalize_id, #positive?, positive_names

Class Method Details

.default_for(actor) ⇒ Object



8
9
10
# File 'app/models/relation/single.rb', line 8

def default_for(actor)
  create! :actor => actor
end

.of(actor) ⇒ Object

The Public belonging to actor



13
14
15
# File 'app/models/relation/single.rb', line 13

def of(actor)
  actor(actor).first
end

Instance Method Details

#nameObject

The name of public relation



19
20
21
# File 'app/models/relation/single.rb', line 19

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