i have a Project Model and a ProjectAttribute Model that basically have 3 fields: name, value, project_id, used to store key-value records about Project, i've tried the approach below but without any success.
project.rb
class Project < ActiveRecord::Base
has_many :project_attributes
searchable do
text :title, :boost => 2
text :description
string :att_name, :multiple => true do
project_attributes.map { |p| p.name }
end
string :att_value, :multiple => true do
project_attributes.map { |p| p.value }
end
end
end
Its possible to use ProjectAttribute fields as criteria to Project.search getting all projects having 3 rooms?
Ex:
Project.search do
with(:att_name, 'rooms')
with(:att_value, '3')
end