I have a radio button within my form as follows
<div class="btn-group" data-toggle="buttons-radio">
<%= f.radio_button :start_year, :class=> "btn", :value=> '2007' %> 2007
<%= f.radio_button :start_year, :class=> "btn", :value=> '2008' %> 2008
<%= f.radio_button :start_year, :class=> "btn", :value=> '2009' %> 2009
</div>
I am using twitter bootstrap
I want to do something like the following:
<div class="btn-group" data-toggle="buttons-radio">
<%= f.radio_button :start_year, :class=> "btn", :value=> '2007', if @dates.start_year == 2007 :checked => true end %> 2007
<%= f.radio_button :start_year, :class=> "btn", :value=> '2008', if @dates.start_year == 2008 :checked => true end %> 2008
<%= f.radio_button :start_year, :class=> "btn", :value=> '2009', if @dates.start_year == 2009 :checked => true end %> 2009
</div>
But I get the following error:
syntax error, unexpected keyword_ensure, expecting ')'
syntax error, unexpected keyword_end, expecting ')'
I must be making a mistake in the if statement within the radio button, but I'm not sure how exactly to correct this