Skip to content

Instantly share code, notes, and snippets.

@soilforlifeforms
Last active September 8, 2015 15:48
Show Gist options
  • Save soilforlifeforms/463f6b0db0166cc71d6e to your computer and use it in GitHub Desktop.
Save soilforlifeforms/463f6b0db0166cc71d6e to your computer and use it in GitHub Desktop.
js issue
<%= form_for([@group, @gardener, @garden]) do |g| %>
<div class="panel panel-default">
<%= render "shared/error_messages", :target => @garden %>
<h3> Garden information </h3>
<%= g.fields_for :physical_info do |pi| %>
<div class="field" >
<%= pi.label :at_home, "Is the garden located at home" %> <br/>
<%= pi.radio_button :at_home, wrapper_html: {id: "at_home"} %>
<%= pi.label :at_home, "Yes" %>
</div>
<div class="address">
<%= pi.label :address, "If the garden is not located at home what is the address of the garden?" %>
<%= pi.text_field :address, wrapper_html: {id: "address"} %>
</div>
<% end %>
<div class="form-actions">
<%= g.submit 'continue', :class => 'btn btn-lg btn-success' %>
</div>
</div>
<% end %>
class Garden <ActiveRecord::Base
belongs_to :gardener
has_one :physical_info
accepts_nested_attributes_for :physical_info
has_many :pictures
accepts_nested_attributes_for :pictures
end
$(function() {
$('input[id=at_home]').on('click init-at_home', function() {
$('#address').toggle($('#at_home').prop('checked'));
}).trigger('init-at_home');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment