Module: Lite::Uxid::Record::Hashid::ClassMethods
- Defined in:
- lib/lite/uxid/record/hashid.rb
Instance Method Summary collapse
Instance Method Details
#find_by_uxid(uxid) ⇒ Object
19 20 21 22 |
# File 'lib/lite/uxid/record/hashid.rb', line 19 def find_by_uxid(uxid) decoded_id = Lite::Uxid::Reversible::Hashid.decode(uxid, prefix: new.uxid_prefix) find_by(id: decoded_id) end |
#find_by_uxid!(uxid) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/lite/uxid/record/hashid.rb', line 24 def find_by_uxid!(uxid) record = find_by_uxid(uxid) return record unless record.nil? raise ActiveRecord::RecordNotFound end |