Hello Folks,
In earlier post of mine, we have seen, how to implement “Auto Select”, with the help of Prototype and Rails.
Now, that Rails-3 has been released, lot of changes are already made. In-built support for Prototype has been removed. Still if you wish to use prototype, all you need is to install its gem.
Here, I am covering the same example:
- Select ‘Country’ from the first drop down.
- Second drop down will populate the list of ‘States’. If you select any state:
- Third drop down will populate the list of ‘Countries’.
All I am using here is Rails-3, Rails-3 UJS, and Jquery.
I would also like to thank Ryan Bates, for the railscasts he provided to implement this using unobtrusive javascript.
Please download the application with the link provided and let me know your feedback.
System Requirements/Features Covered in this application.
- Ruby 1.8.7
- Rails 3.0.0 or higher
- Country -> State -> City Drop down
- Ajax Search
Steps to run the application:
- Create a schema. Change the database.yml accordingly.
- Run rake db:migrate
- Start the server.
- Please do read the README file.
Regards


6 comments
Comment by Ming on September 29, 2011 at 8:48 am
Thanks for posting. But, it would be better if you post this on github.com.
Comment by mliebelt on October 8, 2011 at 8:04 pm
Thank’s for you example application! It would be much more helpful if you would describe what is needed to the the dependent drop-down list running and filled. I have seen the following, but I am not sure if that is sufficient: app/views/users/_form.html.erg, app/controllers/users_controller.rb, public/javascript/application.js. Is that sufficient?
Comment by madhu on October 29, 2011 at 1:40 pm
it is giving an error has access denied. what is the problem
Comment by Puneet Pandey on November 24, 2011 at 12:31 pm
please elaborate the problem in detail. paste some code snippet ( if required )
Thanks
Puneet
Comment by Puneet Pandey on November 24, 2011 at 12:33 pm
the files you’ve mentioned are required. For other dependencies, I will update the README file soon.
Comment by Puneet Pandey on November 24, 2011 at 12:34 pm
@Ming: the application is already on github, see this: https://github.com/puneetpandey/rails3-autoselect