Unverified Commit 14801d36 authored by Matias Garcia Isaia's avatar Matias Garcia Isaia
Browse files

Avoid overriding user's indices

If the models have already been indexed, skip overriding user's
decisions (ie, indexed fields)
parent 193b1a8e
......@@ -2,7 +2,7 @@ require 'acts_as_indexed'
begin
Refinery::Blog::Category.class_eval do
acts_as_indexed :fields => [:title]
acts_as_indexed :fields => [:title] unless self.respond_to? :with_query
end
rescue NameError
end
......@@ -2,7 +2,7 @@ require 'acts_as_indexed'
begin
Refinery::Blog::Comment.class_eval do
acts_as_indexed :fields => [:name, :email, :message]
acts_as_indexed :fields => [:name, :email, :message] unless self.respond_to? :with_query
end
rescue NameError
end
......@@ -2,7 +2,7 @@ require 'acts_as_indexed'
begin
Refinery::Blog::Post.class_eval do
acts_as_indexed :fields => [:title, :custom_teaser, :body]
acts_as_indexed :fields => [:title, :custom_teaser, :body] unless self.respond_to? :with_query
end
rescue NameError
end
......@@ -3,7 +3,7 @@ require 'acts_as_indexed'
begin
Refinery::Image.class_eval do
# Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
acts_as_indexed :fields => [:title]
acts_as_indexed :fields => [:title] unless self.respond_to? :with_query
end
rescue NameError
end
......@@ -2,7 +2,7 @@ require 'acts_as_indexed'
begin
Refinery::Inquiries::Inquiry.class_eval do
acts_as_indexed :fields => [:name, :email, :message, :phone]
acts_as_indexed :fields => [:name, :email, :message, :phone] unless self.respond_to? :with_query
end
rescue NameError
end
......@@ -4,8 +4,11 @@ require 'stringex_lite'
begin
Refinery::Page.class_eval do
# Docs for acts_as_indexed https://github.com/dougal/acts_as_indexed
acts_as_indexed :fields => [:ascii_title, :meta_description,
:menu_title, :browser_title, :ascii_all_page_part_content]
unless self.respond_to? :with_query
acts_as_indexed :fields => [:ascii_title, :meta_description,
:menu_title, :browser_title,
:ascii_all_page_part_content]
end
# Used to index all the content on this page so it can be easily searched.
def all_page_part_content
......
......@@ -3,7 +3,7 @@ require 'acts_as_indexed'
begin
Refinery::Resource.class_eval do
# Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
acts_as_indexed :fields => [:file_name, :title, :type_of_content]
acts_as_indexed :fields => [:file_name, :title, :type_of_content] unless self.respond_to? :with_query
end
rescue NameError
end
......@@ -3,7 +3,7 @@ require 'acts_as_indexed'
begin
Refinery::Setting.class_eval do
# Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
acts_as_indexed :fields => [:name]
acts_as_indexed :fields => [:name] unless self.respond_to? :with_query
end
rescue NameError
end
......@@ -3,7 +3,7 @@ require 'acts_as_indexed'
begin
Refinery::Authentication::Devise::User.class_eval do
# Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
acts_as_indexed :fields => [:username, :email]
acts_as_indexed :fields => [:username, :email] unless self.respond_to? :with_query
end
rescue NameError
end
\ No newline at end of file
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment