Class: Token

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/token.rb

Class Method Summary collapse

Class Method Details

.get(value) ⇒ Object



6
7
8
# File 'lib/token.rb', line 6

def self.get(value)
  find_by_value(value).try(:parent)
end

.get!(value) ⇒ Object



10
11
12
13
# File 'lib/token.rb', line 10

def self.get!(value)
  token = find_by_value!(value)
  token.parent_type.constantize.find(token.parent_id)
end