Module: ActsAsSlugged::FinderMethods
- Defined in:
- app/models/concerns/acts_as_slugged.rb
Instance Method Summary collapse
Instance Method Details
#find(*args) ⇒ Object
39 40 41 42 43 44 |
# File 'app/models/concerns/acts_as_slugged.rb', line 39 def find(*args) return super unless args.length == 1 return super if block_given? where(slug: args.first).or(where(id: args.first)).first || raise(::ActiveRecord::RecordNotFound.new("Couldn't find #{name} with 'slug'=#{args.first}")) end |
#find_by_slug_or_id(*args) ⇒ Object
46 47 48 |
# File 'app/models/concerns/acts_as_slugged.rb', line 46 def find_by_slug_or_id(*args) where(slug: args.first).or(where(id: args.first)).first end |