This is what I finished and it works.
In my show.html.erb for my "trip".
show.html.erb
<div id="activity_form"> <h2>Activities</h2> </div>
Note: remote => true, which tells the Rails controller that this will be an AJAX request, so edit.js.erb is for rendering
<%= link_to activity.location[0, 20], edit_day_activity_path(day, activity), :class=>"btn btn-info fixedwidthbtn", method: :get, :remote => true
_form.html.erb This form is partially located in the "Type of activity" directory (../views/activities/_form.html.erb).
<%= form_for([@day, @activity], :remote => true) do |f| %> <fieldset> <%= f.label :title, "Activity" %> <%= f.text_field :title, :rows => 1 %> </fieldset> <div class="actions"> <%= f.submit %> </div> </form> <%= link_to 'Delete', [@day, @activity], method: :delete, data: { confirm: 'Are you sure?' } %> <% end %>
edit.js.erb This is a file in the Actions submission directory (../views/activities/edit.js.erb). Says to grab the DOM element with id "activity_form" and make a partial "form"
$("#activity_form").html("<%= escape_javascript(render(:partial => "form"))%>");
update.js.erb I enabled this javascript after clicking on the update in the "Edit" form to display the updated part of the list of operations. So I do not need to reload the page to see the update.
$("#activities_list").html("<%= escape_javascript( render(:partial => "/trips/activities") ) %>");
routes.rb This is how I set up routes. Only level 1 is in line with best practices.
resources :trips do resources :days end resources :days do resources :activities end