fix error
This commit is contained in:
1 parent
aeffcf2630
commit
0d8972ea29
22 files changed
+394
-93
No files matched your search
@@ -1,6 +1,21 @@
|
||||
module UniversalTable
|
||||
class Engine < ::Rails::Engine
|
||||
initializer "universal_table" do
|
||||
initializer "universal_table" do
|
||||
if ENV['worker_num']=='0' && File.basename($0) != 'rake' && !Rails.const_defined?('Console')
|
||||
require File.expand_path('../../../app/models/table_entry', __FILE__)
|
||||
require File.expand_path('../../../app/models/u_table', __FILE__)
|
||||
if defined?(TableEntry) && defined?(UTable)
|
||||
if TableEntry.where(sort_number: nil).count>0
|
||||
UTable.all.pluck(:id).each do |u_table_id|
|
||||
table_entries = TableEntry.where(u_table_id: u_table_id).order_by(id: 1)
|
||||
table_entry_ids = table_entries.pluck(:id)
|
||||
table_entry_ids.each_with_index do |id,i|
|
||||
TableEntry.where(id: id).update(sort_number: i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
OrbitApp.registration "UniversalTable", :type => "ModuleApp" do
|
||||
module_label "universal_table.universal_table"
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
|
||||
Reference in new issue
Block a user