IN model...user.rb.
acts_as_ferret({:fields => {:get_text_for_fields_to_index => {}}})
def get_text_for_fields_to_index
[self.first_name, self.last_name, self.login, self.email,
self.basic_profile.about_me, self.basic_profile.city,
self.basic_profile.state, self.basic_profile.country,
self.personal_profile.activities, self.personal_profile.interests,
self.personal_profile.movies,
self.personal_profile.music, self.personal_profile.tv,
self.personal_profile.turn_ons,
self.personal_profile.turn_offs ].join(" ").strip
end
Inside controller..
def search
@query = params[:query].to_s.strip
conditions = ["users.is_test = ? and users.user_type != ?", false,
User::ANONYMOUS]
@users = User.find_with_ferret(@query, {:per_page => @@items_per_page,
:page => params[:page]}, :conditions => conditions)
@total = @users.total_hits
@page_title = "Searched users for '#...@query}' - fStation"
@meta_desc = "Searched users for #...@query} - " +
@users.collect(&:display_fullname).join(',')
render "jokes/search"
end
On Tue, Oct 27, 2009 at 4:06 PM, RubyonRails_newbie <
[email protected]> wrote:
>
> what have I missed?
>
> I'm new to ruby on rails, and followed the tutorial to set it up..
>
> What other config do I need???
>
> On 27 Oct, 10:35, sanjib dhar <[email protected]> wrote:
> > We r using it for a decade!!!!!!!!!!
> >
> > On Tue, Oct 27, 2009 at 4:00 PM, sanjib dhar <[email protected]
> >wrote:
> >
> >
> >
> > > use acts as ferret
> >
> > > On Tue, Oct 27, 2009 at 3:42 PM, RubyonRails_newbie <
> > > [email protected]> wrote:
> >
> > >> Hi there,
> >
> > >> I’ve tried to implement ferret into my web application which would be
> > >> used to search the various models and return results based on the word
> > >> entered.
> >
> > >> I cant get this to work, and wondered if anyone uses any other
> > >> searchable plugin for Ruby on Rails, and if so, what was best?
> >
> > >> I don't need anything specifically fancy – but something that at least
> > >> returns me some results.
> >
> > >> Any Ideas?
> >
> > >> If anyone has had success using ferret – please check out:
> >
> > >>http://groups.google.co.uk/group/rubyonrails-talk/browse_thread/threa.
> ..
> >
> > >> And see if you can help me out….
> >
> > >> Cheers- Hide quoted text -
> >
> > - Show quoted text -
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---