lib/generators/faalis/templates/views/update.json.jbuilder.erb in faalis-0.17.0 vs lib/generators/faalis/templates/views/update.json.jbuilder.erb in faalis-0.18.0
- old
+ new
@@ -1,6 +1,5 @@
json.extract! @<%= resource.underscore %>, :id<%= fields_as_params %>
<% fields.each do |name, type| %><% if type == "has_many" %>json.<%= name %> @<%= resource.underscore %>.<%= name %>, :id, :name
-<% end %><% if type == "belongs_to" %>json.<%= name %> do
- json.id @<%= resource.underscore %>.<%= name %>_id
- json.name @<%= resource.underscore %>.<%= name %>.name
-end<% end %><% end %>
+<% end %><% if type == "belongs_to" %>
+json.partial! 'faalis/relations/belongs_to', object: @<%= resource.underscore %>.<%= name %>, :name => :<%= name %>, :fields => [:id, :name]
+<% end %><% end %>