search for: searchcontrol

Displaying 20 results from an estimated 25 matches for "searchcontrol".

2006 Sep 06
7
Error on Windows and FreeBSD
...Webrick I do not get this error. I start Mongrel using: mongrel_rails start I have mongrel, win32-services and mongrel-service gems installed even through Im not using mongrel as a service at the moment. The whole application works apart from one action. The error I get is: NoMethodError in SearchController#results undefined method `table_name'' for Stop:Class |(__DELEGATION__):2:in `__send__'' (__DELEGATION__):2:in `table_name'' #{RAILS_ROOT}/app/models/search.rb:58:in `find_runs'' #{RAILS_ROOT}/app/models/search.rb:44:in `depature_runs'' #{RAILS_ROOT}/app...
2006 Nov 04
0
form_remote_tag problems with post url
...div. It essentially looks like the following: -------------------------------- search.rhtml ----------------------------------- <%= form_remote_tag(:update => ''search_results'', :url => {:action => :search}, :loading => ''SearchController.disableSearchForm()'', :complete => '' SearchController.enableSearchForm()'', :id => ''search_form'')%> <%= select(:search, :selection, [[''Newest First'', ''new''],[''Most Popular First'',...
2010 Mar 30
6
find conditions issue
...at I want to do now is if I enter in "Rolling" it will still find Rolling Rock. I tried the following but it doesn''t work: @find = Product.find(:first, :conditions => ["title.include? ''#{name}''"]) I get this error: ActiveRecord::StatementInvalid in SearchController#results Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''include''#{name}'') LIMIT 1'' at line 1: SELECT * FROM `products` WHERE (title include''#{name}...
2006 Sep 05
2
question about passing array of AR objects to worker
...meone can help with. whenever i try to pass an array or AR objects to my worker, i end up with a DRb object in the worker...here''s an example class SearchWorker < BackgrounDRb::Rails attr_reader :resources def do_work(resources) logger.info resources.inspect end end class SearchController < ApplicationController def start_search @resources = Resource.find(:all) logger.info @resources.inspect session[:job_key] = MiddleMan.new_worker(:class => :search_worker, :args => @resources) end end class Resource < ActiveRecord::Base include DRbUndumped # att...
2006 May 23
1
Help with observe_field
...ld(:search, :frequency => 0.25, :update => :search_hits, :url => { :action => "search"}) %> <p>Search Results:</p> <div id="search_hits"></div> __Controller: search_controller.rb__ class SearchController < ApplicationController WORDLIST = %w(Rails is a full-stack, really cool, open-source, free thingy!) def search @phrase = request.raw_post || request.query_string matcher = Regexp.new(@phrase) @results = WORDLIST.find_all {|word|word =~ matcher} render(:layout => fa...
2006 Jun 06
1
stack level too deep
Iam new to ferret Iam trying to do a sample application on ferret this is my code: class SearchController < ApplicationController require ''ferret'' include Ferret index = Index::Index.new(:path => ''/path/to/index'') def list end def index index << {:title => "Programming Ruby", :content => "blah blah blah"} i...
2007 Jul 18
5
Strange search result with conditions in find_by_contents
Hi, guys: Strange search result with conditions in find_by_contents! first of all, i''ve installed the acts_as_ferret to my project vender folder by ''ruby script/plugin install svn://projects.jkraemer.net/acts_as_ferret/tags/stable/acts_as_ferret'' in my SearchController def searchforum if !params[:doSearch].nil? if params[:searchTerms].nil? || params[:searchTerms] == "" flash[:notice] = ''Please enter some words to search on.'' else @conditions = " 1 = 1"; if !params[:dateRange].nil? && params[:dateRange] != "&qu...
2006 Jun 25
1
text_field_with_auto_complete nonsense (newbie question)
Hi everyone, I have been introduced to ruby on rails a couple of days ago and it really brings out the fun in programming for the Web. I''m trying to implement a text_field_with_auto_complete as described in script.aculo.us , as follows: controller: class SearchController < ApplicationController auto_complete_for :recipe, :name end search.rhtml: <html> <head><%= javascript_include_tag :defaults %></head> <body><%= text_field_with_auto_complete :recipe, :name %></body> </html> The result, however, is an unrespon...
2006 Aug 19
11
Need help with multi_search
I have been trying to use multi_search to search accross multiple associated models, but I have had no luck at all. I have scoured the net and this forum for all similar posts, but none of them contain enough code for me to get it to work. I am successfully able to search individual models, and then display the results without a problem. I have the following 2 models, Product and Component.
2007 Jan 13
5
Problems using acts_as_ferret
Hi all, I''m trying to use acts_as_ferret and have run into a brick wall. My model is Page My controller is Pages_controller. When in console, I can search for contents, and find results. For example, when I search for "spam" it "finds" 7 results. => #<FerretMixin::Acts::ARFerret::SearchResults:0x2693934 @total_hits=7, @results=[]> you can do a
2011 Apr 07
3
[Rails 3] No route matches error using RSpec even though route DOES match
...params: {:name => "John Doe"} to the "users" action. Indeed, if I run this through my browser, it works perfectly fine. The problem is when using RSpec, it doesn''t work at all. The corresponding spec for this is: require ''spec_helper'' describe SearchController do before :all do Codebase::Application.reload_routes! # a futile attempt to force new routes to be ready, still doesn''t work end context "a GET to /users with a name" do it "should spit out a list of users with that name" do get :users, :nam...
2007 May 02
4
Wrong total_hits when using conditions in find_by_contents
...ons.merge options # get the offset based on what page we''re on options[:offset] = options[:limit] * (options.delete(:page).to_i-1) # now do the query with our options results = Topic.find_by_contents(q, options, find_options) return [results.total_hits, results] end in my SearchController: if params[:doSearch] == "true" if params[:query] == "" flash[:notice] = ''Please enter some words to search on.'' else @conditions = " 1 = 1"; if params[:dateRange] != "" @conditions += " and creationDate >= " + params[:dateR...
2007 Apr 10
3
MultiSearch and ActionView Questions
...>> I usually have a separate Search model class to back my search forms. Question #2: Rather than defining self.full_text_search on each of my 12 models, I am hoping for a cleaner solution, perhaps a module that I can mixin somehow. Also I am pondering the idea of having a separate SearchController so that my search methods are in one place as well. Do you have any guides/suggestions for handling multiple models in a DRY fashion? >> Jens'' Response: >> See above, either create one Search model to handle all searches, or use >> inheritance/mix ins to hand...
2006 Jun 28
1
accessing multiple observe_field from one callback
I have a form that has 4 text_field entries, each one with an observer_field and i want to access the data that is currently inserted on every field from the :update method for each field. i tried using instance variables but it appears that each text_field creates an instance of the searchcontroller for its own. I also tried using the :with => "something" on the definition of the observe_fields and trying to collect them with params[:something] but i get the same problem with instance variables: i can''t access the field info from the other field callbacks. Analysin...
2011 Jan 14
0
[Rail3] How to construct full-text search for habtm associations
...e(:title => "Group1") u1.comments << Comment.create(:message => "hi user2") u2 = User.create :name => "user2" u2.groups << Group.create(:title => "Group2") u2.comments << Comment.create(:message => "hi user1") then SearchController#search will receive a [space] separated query, and it should finds a collection of users that matched query joining groups and comments. it may use User.search scope. but i''ve confused, how do i write search algorism using ActiveRecord::Relation on habtm? forced to hard code complex (o...
2006 May 05
1
Agile Rails (1st edition), depot TDD "exercise"
...e new code (a search function) is left as an exercise for the reader. Well, I think I solved it but I''m not sure I did it right (even though it passes the test). After much experimentation, here''s what I did: 1. Edit the depot/app/controller/search_controller.rb file: class SearchController < ApplicationController def search @query = String.new(params[:query]) @products = Product.find(:all, :conditions => "title like ''%#{@query} %'' OR description like ''%#{@query}%...
2006 May 06
1
depot test-driven development exercise
...function) is left as an exercise for the reader. Well, I think I solved it but I''m not sure I did it the "Rails way" (even though it passes the test). After much experimentation, here''s what I did: 1. Edit the depot/app/controller/search_controller.rb file: class SearchController < ApplicationController def search @query = String.new(params[:query]) @products = Product.find(:all, :conditions => "title like ''%#{@query} %'' OR description like ''%#{@query}%...
2006 Jul 07
4
Help installing Ferret
http://wiki.rubyonrails.com/rails/pages/HowToIntegrateFerretWithRails I followed everything here but at the last I get when loading page get_results Can only handle a String or a Query. RAILS_ROOT: script/../config/.. Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/models/result.rb:27:in `search_each'' #{RAILS_ROOT}/app/models/result.rb:27:in `search_index''
2007 Apr 01
2
strange behavior after switching to DRb server
...using the following option find_by_contents option: :sort => Ferret::Search::SortField::SCORE Before switching to DRb, this worked very well. Afterward, I see the error below. (Resource is my model). Any ideas? Thanks (again...) John --------------------------- RuntimeError in Resource searchController#index invalid value: <SCORE> RAILS_ROOT: script/../config/.. (druby://localhost:9010) ./vendor/plugins/acts_as_ferret/lib/ acts_as_ferret.rb:142:in `_load'' (druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:582:in `load'' (druby://localhost:9010) /usr/local...
2007 Mar 31
8
Problem with encoding (Umlaut: ü, ä...)
...bian). In the (mysql-)database are few records stored, containig german umlauts (? for example). Running a query for "k?ln" returns the correct record in dev-environment but NOTHING at the debian system. But the logs are looking good. It seems the word was correctly submited: Processing SearchController#result (for 127.0.0.1 at 2007-03-31 23:45:47) [POST] Session ID: 55f4544e0b28e991a1460b05dc09744c Parameters: {"commit"=>"suchen", "action"=>"result", "controller"=>"search", "query"=>"k?ln"} I read...