Class: EasyTag::TagContext

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/easy_tag/tag_context.rb

Class Method Summary collapse

Class Method Details

.get_id(context) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'app/models/easy_tag/tag_context.rb', line 6

def self.get_id(context)
  if context.is_a?(String) || context.is_a?(Symbol)
    context_id = self.where(:name => context.to_s).first
  elsif context.is_a?(Integer)
    context_id = context
  else
    raise EasyTag::InvalidContext
  end
  context_id
end