lib/token.rb in laserlemon-has_token-0.3.2 vs lib/token.rb in laserlemon-has_token-0.3.3
- old
+ new
@@ -4,6 +4,11 @@
named_scope :for, lambda{|k| {:conditions => {:parent_type => k.to_s.classify}} }
def self.get(value)
find_by_value(value).try(:parent)
end
+
+ def self.get!(value)
+ token = find_by_value!(value)
+ token.parent_type.constantize.find(token.parent_id)
+ end
end