Displaying 2 results from an estimated 2 matches for "current_course".
2008 Jul 20
1
selected attribute in options_for_select
Hello Everyone
I have a select_tag which I populate using a map, I use
options_for_select method to pass the map and "selected" value. For some
reason I can not get the option "selected" based on the value I pass to
the selected attribute. Here is the code
<%= select_tag :current_course,
options_for_select( Course.find(:all).map {|p| [p.title,p.id]},
@selected )
%>
The corresponding HTML produced is
<select id="current_course" name="current_course" >
<option value="1">Mathematics I</option>
<option value="2&...
2006 Apr 25
0
Need help making code more rails like!
...he only thing that I need for sure is
the call to check_box_tag(). Thanks in advance for any assistance!
The following code is contained within a partial (excuse the formatting
mess):
<% for course in @courses -%>
<%= course.name %>:
<% if course.id.to_s == session[:current_course].to_s -%>
<%= check_box_tag ''post_courses[]'', course.id, true, {:disabled
=> ''disabled''} %><br />
<% else -%>
<%= check_box_tag ''post_courses[]'', course.id %><br />
<...