Sha256: 98c77aa100a678f671eff738265d8a2cd59f9e676a8ffeaa083284512a077363
Contents?: true
Size: 712 Bytes
Versions: 15
Compression:
Stored size: 712 Bytes
Contents
class Site::Client < Site validates_presence_of :url, :callback_url, :secret before_validation :set_secret, on: :create after_create :set_admin scope :administered_by, lambda { |actor| joins(actor: :sent_ties). merge(Contact.received_by(actor)). merge(Tie.related_by(Relation::Admin.instance)) } %w{ url callback_url secret }.each do |m| define_method m do config[m] end define_method "#{ m }=" do |arg| config[m] = arg end end def to_param id end private def set_secret self.secret = SecureRandom.hex(64) end def set_admin contact_to!(author).relation_ids = [ Relation::Admin.instance.id ] end end
Version data entries
15 entries across 15 versions & 2 rubygems