Class: Landable::Author
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Landable::Author
- Includes:
- TableName
- Defined in:
- app/models/landable/author.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.authenticate!(username, token_id) ⇒ Object
6 7 8 9 10 |
# File 'app/models/landable/author.rb', line 6 def self.authenticate!(username, token_id) = where(username: username).first return unless && .access_tokens.fresh.exists?(token_id) end |
Instance Method Details
#can_edit ⇒ Object
17 18 19 20 |
# File 'app/models/landable/author.rb', line 17 def can_edit token = access_tokens.fresh.last token.present? && token.can_edit? end |
#can_publish ⇒ Object
22 23 24 25 |
# File 'app/models/landable/author.rb', line 22 def can_publish token = access_tokens.fresh.last token.present? && token.can_publish? end |
#can_read ⇒ Object
12 13 14 15 |
# File 'app/models/landable/author.rb', line 12 def can_read token = access_tokens.fresh.last token.present? && token.can_read? end |