Sha256: 5abf9cc4b193ec7661e5d6a01e14a5b8c17396d11f2be0213aec8a79f4510c04
Contents?: true
Size: 650 Bytes
Versions: 8
Compression:
Stored size: 650 Bytes
Contents
namespace :cms do desc "Adjust custom Forms max size in the Database" task :adjust_max_size => :environment do columns = ::Form::Row.columns.map(&:name).grep(/^column_\d+/) size_was = columns.size size = RailsAdminCMS::Config.custom_form_max_size if size < size_was (size_was - size).times.each.with_index(1) do |_, i| ActiveRecord::Base.connection.remove_column :form_rows, :"column_#{size_was - i}" end elsif size > size_was (size - size_was).times.each.with_index(size_was) do |_, i| ActiveRecord::Base.connection.add_column :form_rows, :"column_#{i}", :text end end end end
Version data entries
8 entries across 8 versions & 1 rubygems