That or allow passing a list of models to be searched or a finder or passing in results.
Last is probably simplest def site_search(query,results = nil) results ||= ... On Sep 15, 5:37 am, Bryan Larsen <[email protected]> wrote: > Oops, forgot about that one. > > The generators put the search function in your front controller. The > generated function calls Hobo::Controller#site_search which calls > Hobo.find_by_search and then renders the result. It seems to me like > you'd probably want to reimplement Hobo::Controller#site_search, > replacing the call to Hobo.find_by_search with your own finder. In > other words, cut and paste site_search into your front_controller, and > replace the first two lines: > > def site_search(query) > results = ModelA.find(:all, :conditions => ...) + > ModelB.find(:all, :conditions => ...) > all_results = results.select { |r| r.viewable_by?(current_user) } > if all_results.empty? > render :text => "<p>"+ ht(:"hobo.live_search.no_results", > :default=>["Your search returned no matches."]) + "</p>" > else > render_tags(all_results, :search_card, :for_type => true) > end > end > > It seems to me that we should split site_search into two functions so > that nobody has to do any cut and pasting. > > Bryan > > On 10-09-15 12:15 AM, Abbasi Ujjainwala wrote: > > > Yep Kevin is right but I do think I can give a short at what Bryan has > > sugfested and see either I can convince my stake holders to the > > functionality it offiers else, I will be in search of how to modify live out > > of the box search provided by Hobo. Ideal scenario for me is to allow filter > > on the out of the box search for example a drop down list a user can select > > to search Entity A or B or C or ... > > > regards, > > abbasi > > ph: 678 425 4556 > > > -----Original Message----- > > From: [email protected] [mailto:[email protected]] On > > Behalf Of kevinpfromnm > > Sent: Tuesday, September 14, 2010 10:46 PM > > To: Hobo Users > > Subject: [Hobo Users] Re: how to restrict search to perform search on an > > entity type > > > I think he was referring to the live-search and not a particular model > > search. I looked but found no documentation on how (if possible even) > > to change what the live-search searches. I know there's a search > > method on the front controller by default but as to how to go about > > changing it, don't know. > > > On Sep 14, 6:58 pm, Bryan Larsen<[email protected]> wrote: > >> Using the agility tutorial example: > > >> def show > >> @project = find_instance > >> @stories = > >> @project.stories.apply_scopes(:search => [params[:search], > >> :title], > >> :order_by => > >> parse_sort_param(:title, :status)) > >> end > > >> You can simply add further scopes to the chain or the apply_scopes: > > >> @project.stories.not_completed.apply_scopes(...) > > >> You can either use Hobo's automatic scopes: > > >>http://cookbook.hobocentral.net/manual/scopes > > >> or Rails' named scopes: > > >>http://ryandaigle.com/articles/2008/3/24/what-s-new-in-edge-rails-has... > > >> Bryan > > >> On 10-09-14 08:12 PM, Abbasi Ujjainwala wrote: > > >>> Hi, > > >>> I have a requirement to search only one type of entity or allow user to > >>> select which entity she wants to search on. > > >>> The default search basically searches across the board, so question is > >>> how can I configure it to search just the entity which user wants? > > >>> regards, > > >>> abbasi > > >>> ph: 678 425 4556 > > >>> -- > >>> You received this message because you are subscribed to the Google > >>> Groups "Hobo Users" 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/hobousers?hl=en. -- You received this message because you are subscribed to the Google Groups "Hobo Users" 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/hobousers?hl=en.
