diff --git a/app/helpers/additionals_queries_helper.rb b/app/helpers/additionals_queries_helper.rb index 3b0c4dfb..05df28ff 100644 --- a/app/helpers/additionals_queries_helper.rb +++ b/app/helpers/additionals_queries_helper.rb @@ -140,13 +140,13 @@ module AdditionalsQueriesHelper def xlsx_write_header_row(workbook, worksheet, columns) columns_width = [] columns.each_with_index do |c, index| - value = if c.class.name == 'String' + value = if c.instance_of?('String') c else c.caption.to_s end - worksheet.write(0, index, value, workbook.add_format(xlsx_cell_format(:header))) + worksheet.write 0, index, value, workbook.add_format(xlsx_cell_format(:header)) columns_width << xlsx_get_column_width(value) end columns_width diff --git a/lib/additionals.rb b/lib/additionals.rb index f7d6f09d..9e05d8d7 100644 --- a/lib/additionals.rb +++ b/lib/additionals.rb @@ -67,10 +67,10 @@ module Additionals end def settings_compatible(plugin_name) - if Setting[plugin_name].class == Hash + if Setting[plugin_name].instance_of? Hash # convert Rails 4 data (this runs only once) - new_settings = ActiveSupport::HashWithIndifferentAccess.new(Setting[plugin_name]) - Setting.send("#{plugin_name}=", new_settings) + new_settings = ActiveSupport::HashWithIndifferentAccess.new Setting[plugin_name] + Setting.send "#{plugin_name}=", new_settings new_settings else # Rails 5 uses ActiveSupport::HashWithIndifferentAccess