Created
May 21, 2012 21:12
-
-
Save mlins/2764759 to your computer and use it in GitHub Desktop.
Can I somehow access my property instance to build indexes dynamically?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Property < ActiveRecord::Base | |
has_many :agents | |
searchable do | |
agents.each do |scoped_agent| | |
string "sort_agents_#{scoped_agent.id}" do | |
reordered_agents = agents.select { |agent| scoped_agent != agent } | |
reordered_agents << scoped_agent | |
reordered_agents.collect do |agent| | |
agents.last_name_first | |
end.join(' ').gsub(/,/, '') | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment