[Rails] Re: grouped_collection_select collection filter

2013-10-21 Thread Kang Cao
if you want choose states depending countries, you have to use the ajax way. That is when rails renders the page, it doesn't know which country you will choose. Thus you have to write javascript code to watch the country field, when it changes, the code sends messages to server and use

[Rails] Re: AR's find_by_* limits return results. How to avoid id?

2013-05-28 Thread Kang Cao
You should use 'where' if you are using rails 3. the find_by method is not suggested now. Hence your problem is easy to be resolved by User.where(:age=25) On Wednesday, May 29, 2013 7:52:51 AM UTC+8, Ruby-Forum.com User wrote: When I use find_by_name method I get LIMIT 1 result. SELECT