-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Was getting this error. Traced it to the search engine model.
For some reason my enable_for configs are coming through as classes and not strings as is expected by the search_engine model and safe_constantize is not defined on Active::Record classes. I had to comment out for it to work.
This is what my search config looks like:
Refinery::Search.configure do |config|
config.enable_for = ["Refinery::Page", "Refinery::Projects::Property", "Refinery::Blog::Post"]
# config.page_url = "/search"
config.results_per_page = 50
endAny idea how an array of strings could be converted to an array of classes? I check code and can't find anything in the search gem that would suggest conversion.
[4] pry(Refinery::Search::SearchEngine)> Refinery::Search.config.enable_for
=> [Refinery::Page(id: integer, parent_id: integer, path: string, slug: string, custom_slug: string, show_in_menu: boolean, link_url: string, menu_match: string, deletable: boolean,draft: boolean, skip_to_first_child: boolean, lft: integer, rgt: integer, depth: integer, view_template: string, layout_template: string, created_at: datetime, updated_at: datetime),
Refinery::Projects::Property(id: integer, title: string, photo_id: integer, body: text, side_bar: text, position: integer, created_at: datetime, updated_at: datetime, published: boolean, featured: boolean, architect: string, owner_developer: string, general_contractor: string, address: string, city: string, state: string, county: string, completion_date: string, structure_type: string, services_provided: string, related_links: string, photo_credit: string, latitude: decimal, longitude: decimal, in_the_works: boolean, zip: string, projectid: string)]I tried creating another array in the config and it comes out just fine:
Refinery::Search.configure do |config|
...
config.enable_for_model = ["Refinery::Page", "Refinery::Projects::Property", "Refinery::Blog::Post"]
...
end[2] pry(Refinery::Search::SearchEngine)> Refinery::Search.config.enable_for_model.first
=> "Refinery::Page"Must not be an issue for anyone else, but thought I'd throw it out and see if anyone has suggestions.
Metadata
Metadata
Assignees
Labels
No labels