I'm having a hard time getting ahold of the highlight property in my Rails
app. I know the highlight is being return because it's present in curl
results that I get from raise to_curl
.
Simple controller:
def index
@reports = Report.search(params)
end
Simple model:
def self.search(params)
tire.search do
query { string params[:query] } if params[:query].present?
highlight :attachment
# raise to_curl
end
end
Simple *view *(haml):
-
@reports.each do |report|
- @reports.results.each do |report| # <== doesn't work either
- if report.respond_to?(:highlight)
= raw report.highlight.attachment.first.to_s - else
= "broken!" # <=== only ever see this
...
- if report.respond_to?(:highlight)
Abbreviated curl response from raise to_curl in model (FWIW):
https://gist.github.com/3707560
What am I missing?!? What's the proper way of getting ahold of the
'highlight' string associated with each record? I know I'm overlooking the
painfully obvious. Thanks!
--