Sha256: 4923263533f493c3dc18a73b47cdcb1851681c74b8384a259db640040ed14958
Contents?: true
Size: 1.52 KB
Versions: 3
Compression:
Stored size: 1.52 KB
Contents
module Doorkeeper module Orm module Sequel module SequelCompat extend ActiveSupport::Concern # ActiveRecord methods used by Doorkeeper outside the ORM. # Should be extracted at the architectural level. included do plugin :active_model # Sequel 4.47 and higher deprecated #set_allowed_columns if (::Sequel::MAJOR >= 4 && ::Sequel::MINOR >= 47) || ::Sequel::MAJOR >= 5 plugin :whitelist_security end self.raise_on_save_failure = false def update_attribute(column, value) self[column] = value save(columns: [column.to_sym], validate: false) end def update_attributes(*args) update(*args) end def save!(*) save(raise_on_failure: true) end def transaction(opts = {}, &block) db.transaction(opts, &block) end end module ClassMethods def create!(values = {}, &block) new(values, &block).save(raise_on_failure: true) end def table_exists? db.table_exists?(table_name) end # find(1) or find("1") - will work like find(id: 1) # find(name: 'John') - will work like find(name: 'John') def find(*args, &block) if args.first.is_a?(Hash) super(*args, &block) else super(id: args) end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems