I have this form, everything works fine, but I would like to move the
current_user.relationships.build logic to the controller.
<%= form_for(current_user.relationships.build(followed_id: @user.id)) do
|f| %>
<%= f.hidden_field :followed_id %>
<%= f.submit "Follow", class: "btn btn-large btn-primary" %><% end %>
Controller Relationships create method
def create
@user = User.find(params[:relationship][:followed_id])
current_user.follow!(@user)
redirect_to @user
end