Form involving several models related to each other
This view knows far too much about your data model structure.

One level of nesting is reasonably acceptable, but this many is dangerous : in fact, this view needs knowledge about no less than 4 different business objects, not to mention it has to know the relations between them.

Solution 1 : the facade pattern

Abstract away all those details in another object, which would be the sole source of truth for your view : call it a form object, or a presenter, or a context in DCI idiom, whatever.

The idea is that this object has a simple interface that maps to the complex underlying system. We'd need more details on your business logic to be able to help you on this one.

Solution 2 : cook your own "accepts_nested_attributes" method

on your UserRelation model, create a ratings method that provides direct access to your ratings. Then create another method that allows assignment, like ratings_attributes=. In this method, process the passed parameters to create / update associated ratings ; you can find inspiration for this in the source for the accept_nested_attributes method.