Class: DataCacheService
Instance Method Summary
collapse
#convert_parameters, #field_result, #footer_result, #header_result
Constructor Details
4
5
6
7
8
9
|
# File 'app/models/rails_data/concerns/data_cache_service.rb', line 4
def initialize(table_list)
@table_list = table_list
@data_list = @table_list.data_list
@config_table = table_list.data_list.config_table
convert_parameters(@table_list.parameters)
end
|
Instance Method Details
#cache_table ⇒ Object
11
12
13
14
15
16
17
|
# File 'app/models/rails_data/concerns/data_cache_service.rb', line 11
def cache_table
@table_list. =
cache_table_items
@table_list. =
@table_list.done = true
@table_list.save
end
|
#cache_table_items ⇒ Object
19
20
21
22
23
24
|
# File 'app/models/rails_data/concerns/data_cache_service.rb', line 19
def cache_table_items
@config_table.collection.call(@params).each_with_index do |object, index|
row = field_result(object, index)
@table_list.table_items.create(fields: row)
end
end
|