Class: OrmAdapter::ActiveRecord
- Inherits:
-
Base
- Object
- Base
- OrmAdapter::ActiveRecord
show all
- Defined in:
- lib/orm_adapter/adapters/active_record.rb
Instance Attribute Summary
Attributes inherited from Base
#klass
Instance Method Summary
collapse
Methods inherited from Base
inherited, #initialize
Instance Method Details
#column_names ⇒ Object
Return list of column/property names
6
7
8
|
# File 'lib/orm_adapter/adapters/active_record.rb', line 6
def column_names
klass.column_names
end
|
#create!(attributes = {}) ⇒ Object
31
32
33
|
# File 'lib/orm_adapter/adapters/active_record.rb', line 31
def create!(attributes = {})
klass.create!(attributes)
end
|
#destroy(object) ⇒ Object
36
37
38
|
# File 'lib/orm_adapter/adapters/active_record.rb', line 36
def destroy(object)
object.destroy && true if valid_object?(object)
end
|
#find_all(options = {}) ⇒ Object
26
27
28
|
# File 'lib/orm_adapter/adapters/active_record.rb', line 26
def find_all(options = {})
construct_relation(klass, options)
end
|
#find_first(options = {}) ⇒ Object
21
22
23
|
# File 'lib/orm_adapter/adapters/active_record.rb', line 21
def find_first(options = {})
construct_relation(klass, options).first
end
|
#get(id) ⇒ Object
16
17
18
|
# File 'lib/orm_adapter/adapters/active_record.rb', line 16
def get(id)
klass.where(klass.primary_key => wrap_key(id)).first
end
|
#get!(id) ⇒ Object
11
12
13
|
# File 'lib/orm_adapter/adapters/active_record.rb', line 11
def get!(id)
klass.find(wrap_key(id))
end
|