simple form - Rendering rails output -
i trying set simple form outputs in rails 4 app.
i have project model, scope model , participant model.
participant belongs scope. scope belongs project.
the participant model has 2 attributes - 1 'location_specific', boolean , 1 'location' string.
if location_specific true, want output location required.
in participants show partial, have:
<div class="datasubtextq">location: <span class="datasubtext"> <% if @project.scope.participant.location_specific == true %> <%= @project.scope.participant.location %> <% else %> <%= render :text => "remote participation" %> <% end %> </span> </div>
in form, have:
<div class="row"> <div class="col-md-3 col-md-offset-1"> <%= f.label 'can participants participate remotely?', :class => 'question-project' %> </div> <div class="col-md-7"> <%= par.collection_radio_buttons :location_specific, [[true, ' yes'], [false, ' no']], :first, :last, {:item_wrapper_class => 'fixradio'}, {:class => "response-project"} %> </div> </div> <div id="requiredlocation"> <div class="row"> <div class="col-md-3 col-md-offset-1"> <%= f.label 'select participation location', :class => 'question-project' %> </div> <div class="col-md-7"> <div class="response-project"> <%= par.select :location, options_for_select(["new york", "boston", "florida"]), label: 'where participants take part in project?', prompt: "choose one", class: 'response-project' %> </div> </div> </div> </div>
my problem each time try this, 'remote participation alternative. city option not displaying should. ideas on i've done wrong?
thank you
Comments
Post a Comment