Class: Boxroom::ShareLink
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Boxroom::ShareLink
- Defined in:
- app/models/boxroom/share_link.rb
Class Method Summary collapse
Class Method Details
.active_share_links ⇒ Object
12 13 14 |
# File 'app/models/boxroom/share_link.rb', line 12 def self.active_share_links where('link_expires_at >= ?', DateTime.now).order(:link_expires_at) end |
.file_for_token(token) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/models/boxroom/share_link.rb', line 16 def self.file_for_token(token) share_link = find_by_link_token(token) if share_link.link_expires_at < DateTime.now raise 'This share link expired.' else share_link.user_file end end |