Class EditorRequest
In: app/models/editor_request.rb
Parent: ActiveRecord::Base

editor would like to become an editor for person. Sent in an email with link keyed by token. Sends email with link after_create. See EditorRequestMailer.

Methods

Public Instance methods

Send email

[Source]

    # File app/models/editor_request.rb, line 29
29:   def after_create
30:     EditorRequestMailer.deliver_request(self)
31:   end

Set to expire in 1 week. Auto-set token.

[Source]

    # File app/models/editor_request.rb, line 18
18:   def before_validation
19:     self.email = person.try(:email)
20:     self.expires_at = 1.week.from_now
21:     self.token = Authlogic::Random.friendly_token
22:   end

[Source]

    # File app/models/editor_request.rb, line 24
24:   def destroy_duplicates
25:     EditorRequest.destroy_all :person_id => person_id, :editor_id => editor_id
26:   end

Make editor an editor of person

[Source]

    # File app/models/editor_request.rb, line 34
34:   def grant!
35:     unless person.editors.include?(editor)
36:       person.editors << editor
37:       EditorRequestMailer.deliver_notification(self)
38:     end
39:     destroy
40:   end

[Validate]