class BazaModels::BazaOrmAdapter
Public Class Methods
new(args)
click to toggle source
# File lib/baza_models/baza_orm_adapter.rb, line 4 def initialize(args) @klass = args.fetch(:class) end
Public Instance Methods
column_names()
click to toggle source
# File lib/baza_models/baza_orm_adapter.rb, line 8 def column_names klass.column_names end
create!(attributes = {})
click to toggle source
# File lib/baza_models/baza_orm_adapter.rb, line 28 def create!(attributes = {}) klass.create!(attributes) end
destroy(object)
click to toggle source
# File lib/baza_models/baza_orm_adapter.rb, line 32 def destroy(object) if valid_object?(object) object.destroy else false end end
find_all(options = {})
click to toggle source
# File lib/baza_models/baza_orm_adapter.rb, line 24 def find_all(options = {}) klass.where(options) end
find_first(options)
click to toggle source
# File lib/baza_models/baza_orm_adapter.rb, line 20 def find_first(options) klass.find_first(options) end
get(id)
click to toggle source
# File lib/baza_models/baza_orm_adapter.rb, line 16 def get(id) klass.where(id: wrap_key(id)).first end
get!(id)
click to toggle source
# File lib/baza_models/baza_orm_adapter.rb, line 12 def get!(id) klass.find(wrap_key(id)) end