search for: search_item

Displaying 2 results from an estimated 2 matches for "search_item".

2010 Oct 31
9
self.where('section = ?', '%:search_item%')
...rying to do a search where I can enter a part of a word and the search find all occurrences of that part word in the field. The above subject does not work. Can anyone help I am using Rails 3 and ruby 1.9.2 I use to be able to do it in rails 2.x. In my Model I have the following:- def self.search(search_item) if search_item self.where(''section = ?'', ''%:search_item%'') else self.all end end In my controller I have:- @homepages = Homepage.search(params[:search]) respond_to do |format| format.html # index.html.erb format.xml...
2010 Oct 30
2
ArgumentError (wrong number of arguments (2 for 0)):
..."homepages" WHERE ("homepages"."section" = ''%Gar%'') ArgumentError (wrong number of arguments (2 for 0)): ****************************************************************** In my model I have:- self.where(''section <= ?'', "%#{search_item}%") or self.where(:section => "%#{search_item}%") I am making an ajax call using a form_tag. "Gar" is being passed to "search_item" In my controller I have:- def index @homepages = Homepage.search(params[:search]) respond_to do |format| forma...