Class: JunglePath::DBAccess::IO::Update
- Inherits:
-
Object
- Object
- JunglePath::DBAccess::IO::Update
show all
- Includes:
- InitDB
- Defined in:
- lib/jungle_path/db_access/io/update.rb
Instance Method Summary
collapse
Methods included from InitDB
#handle_json_columns, #initialize
Instance Method Details
#_model(model) ⇒ Object
9
10
11
12
13
|
# File 'lib/jungle_path/db_access/io/update.rb', line 9
def _model(model)
update = handle_json_columns(model, model._modified_hash)
count = update_by_primary_key model, update
return {update_count: count}
end
|
#_models(model_filter, model_values, confirm = false) ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/jungle_path/db_access/io/update.rb', line 15
def _models(model_filter, model_values, confirm=false)
ds = @db[model_filter._table_name].where(handle_json_columns(model_filter, model_filter._has_value_hash))
count = 0
count = ds.update(handle_json_columns(model_values, model_values._has_value_hash)) if confirm
return {update_count: count}
end
|