I have a form that I feel I am overcomplicating because of the relationship between models that are involved. Can you let me know if there's a more elegant solution to what I have?
(for reference) The form ultimately looks like this:
The relationship between the involved models:
user_relation has_many :user_relation_skills
user_relation_skills has_many :progresses
progress has_many :ratings, :as => :ratable
The form looks like this (I removed most of the classes/extraneous information but left the divs in to give a better idea of whats going on):
<%= simple_form_for(@user_relation) do |f| %>
<%= f.fields_for :user_relation_skills do |ff| %>
<%= ff.fields_for :progresses do |fff| %>
<%= fff.fields_for :ratings do |ffff| %>
<div>
<div>
<%= link_to(user_relation_skill_path(ffff.object.scope)) do %>
<%= ffff.object.scope.skill.category.name %> <i class='icon-arrow-right'></i> <%= ffff.object.scope.skill.name %>
<% end %>
</div>
</div>
<% if @current_type_for_views == 'coach' %>
<div>
<div>
<%= ffff.select("value", 1..8, {}, {class: "ratings-skill"}) %>
</div>
<div>
<div class='small-offset-8 small-4 columns'>
<%= button_tag(type: 'submit', class: "small button") do %>
<i class="icon-check"></i>Update
<% end %>
</div>
</div>
</div>
<% else %>
<div>
<div>
<%= ffff.select("value", 1..8, {}, {class: "static-rating"}) %>
</div>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
Are this many 'nests' in a form typical or should I be doing something else?
I'm including part of a simple UML diagram with a focus on the "Rating" model that is attached to many things (there are lots of things in the app that can be rated):
Most of the lines going up out of the screen connect either to unimportant models or Active Record directly. The only pertinent thing that is not pictured is the fact that Rating rates Users (a user model that someone would typically expect).