Ruby (on Rails)

I've been using Ruby on Rails for a few years, in my spare time, and hope to keep working with it whenever the opportunity arises. A couple of college friends and I created hospitalpages.ie which is was developed using Ruby on Rails, Git and Capistrano for deployment. I also hope to dabble more in pure Ruby scripting, to date I've used it for automating data insertion with MySQL and some file parsing.

Get value from checkbox in rails (2.0.4)

With below checkbox, access the value in controller with something like :params[checkbox_name], e.g. if (:params[checkbox_name] == 'selected') # do something..

1 <%= check_box_tag 'checkbox_name', 'selected' %>

becomes:

1 <input type="checkbox" value="selected" name="checkbox_name" id="checkbox_name">

Note if the checkbox is not selected you won't be able to access the value, it is only accessible if the checkbox is selected.

blog comments powered by Disqus