On Dec 18, 2006, at 8:36 PM, Mike Beccaria wrote:
Another question...
The controller:
@query= Movie.find_by_solr(params[:squery])
Then in the view:
<label><%= @query %></label>
Debugging tip: use <%= debug @query %> to see exactly what you got.
Produces 2 hits (as per count_by_solr) that look like this : "##"
Why does it return a "#" and how do you return the result
attributes (like
title or synopsis etc.) in the array? Do you have to run a find on the
database at that point?
find_by_solr is designed to pull the database records by primary key
after it searches Solr, so what you get back is the same kind of
thing you'd get back if you did a regular ActiveRecord
#find_all_by_<whatever>. In other words, you get an array of Movie
objects back. So try using @query.each loop to display each hit.
I'd call it something besides @query, since it really is @results :)
Erik