Displaying 1 result from an estimated 1 matches for "app_lin".
Did you mean:
  applin
  
2006 May 05
0
is this good for a conditional checkbox?
...s can 
access. in my view, i have a conditional that decides whether the 
checkbox is checked or unchecked. being new to this, i just did it the 
only way i could think of and want to see if there''s a better way of 
accomplishing it.
<%
selected_app = @user.apps.detect{ |app| app.id == app_line.id }
if selected_app
	is_checked = ''checked''
else
	is_checked = nil
end
-%>
<tr>
	<td><%= app_line.name %></td>
	<td><%= check_box ''add_app'', app_line.id, { :checked => is_checked }, 
''yes'', ''no...