Module: ActsAsSlugged::FinderMethods

Defined in:
app/models/concerns/acts_as_slugged.rb

Instance Method Summary collapse

Instance Method Details

#find(*args) ⇒ Object



37
38
39
40
41
42
# File 'app/models/concerns/acts_as_slugged.rb', line 37

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