Thursday, November 29, 2012

[Rails] Tokeninput incremental search not working

Rails 3.1.3

After watching
http://railscasts.com/episodes/258-token-fields?autoplay=true
I have installed the similar functionality to my app.

However,

def index
@cities = City.all
...

does in fact give the list of all cities in the text field, but

def index
@cities = City.where("name like ?", "%#{params[:q]}%")
...

does NOT search cities at all.

Since above case works (though not incremental filter), the problem must
be the second query part.
But I don't see any problem in the where clause. It does not raise any
errors at all. Simply, puts

"No results"

Can you guess where the problem is?

soichi

--
Posted via http://www.ruby-forum.com/.

--
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 https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate