Select field from database with option selected
select("sess", "callcenter_client_id", CallcenterClient.find_all.collect {|p| [ p.name, p.id ] }, { :selected => @sess.callcenter_client_id.to_i })
make sure that the :selected entry is an integer.
DZone Snippets > raj2569 > idioms
12388 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
select("sess", "callcenter_client_id", CallcenterClient.find_all.collect {|p| [ p.name, p.id ] }, { :selected => @sess.callcenter_client_id.to_i })
<%= render(:partial => "animal" , :collection => %w{ ant bee cat dog elk }, :spacer_template => "spacer" ) %>
t = 4.weeks.ago
a[i] ||=0