Skip to content

Commit

Permalink
Merge pull request ManageIQ#92 from slemrmartin/fix-no-model-collecti…
Browse files Browse the repository at this point in the history
…ons-cache

Fix of supported* caches
  • Loading branch information
agrare committed Apr 20, 2020
2 parents 3bb7183 + 27fe41b commit 3da1b1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def saveable?

# @return [Boolean] true if the model_class supports STI
def supports_sti?
@supports_sti_cache = model_class.column_names.include?("type") if @supports_sti_cache.nil?
@supports_sti_cache = model_class&.column_names.to_a.include?("type") if @supports_sti_cache.nil?
@supports_sti_cache
end

Expand All @@ -62,7 +62,7 @@ def supports_column?(column_name)
@supported_cols_cache ||= {}
return @supported_cols_cache[column_name.to_sym] unless @supported_cols_cache[column_name.to_sym].nil?

include_col = model_class.column_names.include?(column_name.to_s)
include_col = model_class&.column_names.to_a.include?(column_name.to_s)
if %w(created_on created_at updated_on updated_at).include?(column_name.to_s)
include_col &&= ActiveRecord::Base.record_timestamps
end
Expand Down
2 changes: 1 addition & 1 deletion lib/inventory_refresh/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module InventoryRefresh
VERSION = "0.3.4".freeze
VERSION = "0.3.5".freeze
end

0 comments on commit 3da1b1f

Please sign in to comment.