Refactoring: Momorize result and more idiomatic ruby.
This commit is contained in:
parent
e006684c83
commit
44e89271fe
1 changed files with 2 additions and 14 deletions
|
@ -71,13 +71,7 @@ returns
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.searchable
|
def self.searchable
|
||||||
models = []
|
@searchable ||= Models.all.keys.select { |model| model.respond_to?(:search_preferences) }
|
||||||
all.each_key do |model_class|
|
|
||||||
next if !model_class
|
|
||||||
next if !model_class.respond_to? :search_preferences
|
|
||||||
models.push model_class
|
|
||||||
end
|
|
||||||
models
|
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
@ -93,13 +87,7 @@ returns
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.indexable
|
def self.indexable
|
||||||
models = []
|
@indexable ||= Models.all.keys.select { |model| model.method_defined?(:search_index_update_backend) }
|
||||||
all.each_key do |model_class|
|
|
||||||
next if !model_class
|
|
||||||
next if !model_class.new.respond_to? :search_index_update_backend
|
|
||||||
models.push model_class
|
|
||||||
end
|
|
||||||
models
|
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
Loading…
Reference in a new issue