Hi Pat,
This is my TripDay model index:
# ThinkingSphinx Index
define_index do
indexes spots.name, :as => :spot_name
indexes spots.city, :as => :spot_city
indexes spots.state, :as => :spot_state
indexes spots.country, :as => :spot_country
indexes spots.season, :as => :spot_season
indexes trip.name, :as => :name, :sortable => true
indexes trip.duration, :as => :duration
indexes trip.status, :as => :status
has spots(:id), :as => :spot_id
#has trip.budget, :as => :budget
#has trip(:created_at), :as => :created_at
has trip(:rating_average), :as => :rating_average
has trip_id
# set_property :delta => true
end
But it doesn't work.
On Apr 11, 10:28 am, Pat Allan <[email protected]> wrote:
> Hi Victor
>
> You'd need to add that column as an attribute in your TripDay index, via the
> trip association.
>
> --
> Pat
>
> On 09/04/2011, at 6:48 PM, Victor wrote:
>
>
>
>
>
>
>
> > Hi Pat, using ROR 2.3.8
>
> > I have this in City.rb:
>
> > @trip_days = TripDay.published.search params[:keyword], {
> > :conditions => conditions,
> > :star => true,
> > :group_by => 'trip_id',
> > :group_function => :attr,
> > :page => params[:page]
> > }.merge(:order => 'rating_average DESC')
> > @trips = @trip_days.collect { |trip_day| trip_day.trip }
>
> > How can I tell Rails to get the rating_average from Trip model column,
> > instead of TripDay model? Because the TripDay model does not have
> > rating_average. It's actually Trip model that gets rated.
>
> > Thank you.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Thinking Sphinx" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> > athttp://groups.google.com/group/thinking-sphinx?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.