Have you had any luck figuring this one out? I''m having the same
problem.
On Dec 22 2007, 10:53 am, Thiago Guerra
<thiag...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi everyone,
>
> I''m trying to use act_as_ferretmulti_searchwith paginating_links
> plugin but I''m getting a undefined method formulti_searchwhich is
a
> act_as_ferret method that I''ve been using a lot in my app. I just
> can''t see what I''m doing wrong and I''m sure it
is just a little
> detail.
>
> Here is my code:
>
> ############# This is my class method
>
> def paginating_ferret_multi_search(models, options)
> count =multi_search(options[:q], {:limit => :all, :lazy
> => true}, models).total_hits
>
> PagingEnumerator.new(options[:page_size], count, false,
> options[:current], 1) do |page|
> offset = (options[:current].to_i - 1) *
> options[:page_size]
> limit = options[:page_size]
> multi_search(models, options[:q], {:offset =>
> offset, :limit => limit})
> end
> end
>
> ########### This is how I''m calling it in my controller:
>
> def search
> @title = "aykall - search"
> if params[:q]
> query = sanitize(params[:q])
> begin
> @users = User.paginating_ferret_multi_search([Spec, Faq],
> {:q => query, :page_size => 10, :current => params[:p]})
> @users = @users.sort_by { |user| user.spec.last_name }
> rescue Ferret::QueryParser::QueryParseException
> flash[:notice] = "Invalid character in search"
> end
> end
> end
>
> ######## the error I''m getting is: undefined method
`multi_search'' for
> User:Class
>
> ########## when I use self. on my classmethod i get a undefined method
> `paginating_ferret_multi_search'' for User:Class
>
> def self.paginating_ferret_multi_search(models, options)
> count = self.multi_search(options[:q], {:limit => :all, :lazy
=>
> true}, models).total_hits
>
> PagingEnumerator.new(options[:page_size], count, false,
> options[:current], 1) do |page|
> offset = (options[:current].to_i - 1) * options[:page_size]
> limit = options[:page_size]
> self.multi_search(models, options[:q], {:offset =>
> offset, :limit => limit})
> end
> end
>
> I don''t know what else to try...
>
> Hope some one can help me around here...
>
> Thanks,
> Thiago Guerra
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---