search for: pages_for

Displaying 9 results from an estimated 9 matches for "pages_for".

2006 May 01
12
pagination in acts_as_ferret
I''m just wondering where I would put the pagination for search results when using "acts_as_ferret". At the moment my search code is.. def search @query = params[:query] || '''' unless @query.blank? @results = Tutorial.find_by_contents @query end end Cheers SchmakO -- Posted via http://www.ruby-forum.com/.
2007 Oct 03
3
Pagination problem with acts_as_ferret
...9;s my code: Controller: def search @users = User.available_users @user = User.find(session[:user_id]) @query = params[:query] || '''' @total, @user_profiles = UserProfile.multi_search(@query, [ WorkProfile, SchoolProfile ], :page => (params[:page]||1)) @pages = pages_for(@total) unless @query.blank? @results = UserProfile.find_by_contents @query end end model: def self.multi_search(q, additional_models = [], options = {}) return nil if q.nil? or q=="" default_options = {:limit => 1, :page => 1} options = default_options.merge opti...
2007 May 02
4
Wrong total_hits when using conditions in find_by_contents
..." and creationDate >= " + params[:dateRange] end if params[:forumID] != "" @conditions += " and forum_id = " + params[:forumID] end @total, @topics = Topic.full_text_search(params[:query], {:page => (params[:page]||1)}, {:conditions => @conditions}) @pages = pages_for(@total) end it always return only 10 search results. no more search result. i don''t know why! and this article doesn''t work! http://www.ruby-forum.com/topic/93822 thanks! -- Posted via http://www.ruby-forum.com/.
2007 Jul 03
4
problems with acts_as_ferret
...<%= result[:title] %> Score: <%= result[:score] %><br/><br/> <% end %> And this is the controller: def search @query = params[:q] @total, @results = Post.find_storage_by_contents(@query, :page => (params[:page]||1)) @pages = pages_for(@total) end This is the code from post.rb: def self.find_storage_by_contents(query, options = {}) # Get the index that acts_as_ferret created for us index = self.aaf_index.ferret_index results = [] # search_each is the core search function from Ferret, which Acts_as_ferret hides...
2007 Jul 18
5
Strange search result with conditions in find_by_contents
...itions += " and forum_id = " + params[:forumID] end # @total, @topics = Topic.full_text_search(params[:searchTerms], :page => (params[:page]||1)) @total, @topics = Topic.full_text_search(params[:searchTerms], {:page => (params[:page]||1)}, {:conditions => @conditions}) @pages = pages_for(@total) end end end in my model Topic: def self.full_text_search(q, options = {}, find_options = {}) return nil if q.nil? or q=="" default_options = {:limit => 10, :page => 1} options = default_options.merge options # get the offset based on what page we''re on...
2007 Aug 14
0
problem searching dynamic strings with acts_as_ferret
...ts_as_ferret? I am listing the method here: def search_names @users = User.available_users @user = User.find(session[:user_id]) @query = params[:query] || '''' @total, @users = User.multi_search(@query, [ WorkProfile ], :page => (params[:page]||1)) @pages = pages_for(@total) unless @query.blank? @results = User.find_by_contents @query end end Could you please help me with this... Cheers Cass -- Posted via http://www.ruby-forum.com/.
2007 Apr 09
0
Search Results
...g acts_as_ferret and so far things are looking pretty sweet. I''m trying to write the view code for my results page. My controller methods looks like this def search @query=params[:query] @total, @terms = Term.full_text_search(@query, :page => (params[:page]||1)) @pages = pages_for(@total) end Not sure how to proceed. Any ideas? -- Posted via http://www.ruby-forum.com/.
2007 Jul 04
2
problems after gem update
Hi, I had ferret working wonderfully but i am regretting doing a gem update today. I had alot of trouble first installing it and was really happy to have it working. The upgrade was from 0.3.1 to 0.4.0. The problem is; in the rails console, >> @results = Book.find_by_contents("peter pan") => #<ActsAsFerret::SearchResults:0x487040c @total_hits=0, @results=[]> Its indexing
2006 Nov 06
21
acts_as_ferret and associations
...t belongs_to :author end class Author < ActiveRecord::Base has_many :books end and in the controller: def search if params[:query] @query = params[:query] @total, @books = Book.full_text_search(@query, :page => (params[:page]||1)) @pages = pages_for(@total) else @books = [] end end I can use the acts_as_ferret plugin to search for a book by title but it isn''t picking up the authors through the association. So I can''t do a search for books by author. I''ve a feeling I''ve left some config ou...