Ruby on Rails Saturday, October 30, 2010

Can anyone tell me why I am getting this error using rails3 and
Ruby1.9.2:-

Completed 200 OK in 212313ms (Views: 2.8ms | ActiveRecord: 0.0ms)
Homepage Load (0.2ms) SELECT "homepages".* FROM "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|
format.html # index.html.erb
format.xml { render :xml => @homepages }
format.js {render :js => @homepages}
end

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment