radiobutton with ruby
i m doing a project on "student attendance management system".i using rail of version 1.9.1 and rail of version 2.5. i wanted to use radiobutton in my project to mark present and absent s开发者_运维百科o how can i use?please send me the code and what should i do? if you want to give any suggetion so i will very happy.
Taken from the rails api docs:
radio_button(object_name, method, tag_value, options = {})
Returns a radio button tag for accessing a specified attribute (identified by method) on an object assigned to the template (identified by object). If the current value of method is tag_value the radio button will be checked.
To force the radio button to be checked pass :checked => true in the options hash. You may pass HTML options there as well. Examples
# Let's say that @student.attendance returns "rails": radio_button("student", "attendance", "present") radio_button("student", "attendance", "absent") # => <input type="radio" id="student_attendance_present" name="student[attendance]" value="present" checked="checked" /> # <input type="radio" id="student_attendance_absent" name="student[attendance]" value="absent" /> radio_button("user", "receive_newsletter", "yes") radio_button("user", "receive_newsletter", "no") # => <input type="radio" id="user_receive_newsletter_yes" name="user[receive_newsletter]" value="yes" /> # <input type="radio" id="user_receive_newsletter_no" name="user[receive_newsletter]" value="no" checked="checked" />
精彩评论