Module: Doorkeeper::Orm::Sequel::SequelCompat::ClassMethods
- Defined in:
- lib/doorkeeper/orm/sequel/models/concerns/sequel_compat.rb
Instance Method Summary collapse
- #create!(values = {}, &block) ⇒ Object
-
#find(*args, &block) ⇒ Object
find(1) or find(“1”) - will work like find(id: 1) find(name: ‘John’) - will work like find(name: ‘John’).
- #table_exists? ⇒ Boolean
Instance Method Details
#create!(values = {}, &block) ⇒ Object
38 39 40 |
# File 'lib/doorkeeper/orm/sequel/models/concerns/sequel_compat.rb', line 38 def create!(values = {}, &block) new(values, &block).save(raise_on_failure: true) end |
#find(*args, &block) ⇒ Object
find(1) or find(“1”) - will work like find(id: 1) find(name: ‘John’) - will work like find(name: ‘John’)
48 49 50 51 52 53 54 |
# File 'lib/doorkeeper/orm/sequel/models/concerns/sequel_compat.rb', line 48 def find(*args, &block) if args.first.is_a?(Hash) super(*args, &block) else super(id: args) end end |
#table_exists? ⇒ Boolean
42 43 44 |
# File 'lib/doorkeeper/orm/sequel/models/concerns/sequel_compat.rb', line 42 def table_exists? db.table_exists?(table_name) end |