Sha256: 7d97e83d96b6262fc4fbd90d7bc585eba89339abb37397b3ba39e961d7a0f8a7

Contents?: true

Size: 532 Bytes

Versions: 16

Compression:

Stored size: 532 Bytes

Contents

json.array! @<%= resource.pluralize.underscore %> do |<%= resource.underscore %>|
  json.extract! <%= resource.underscore %>, :id<%= fields_as_params %><% fields.each do |name, type| %><% case type
  when "belongs_to" %>
  json.<%= name %> do
    if <%= resource.underscore %>.<%= name %>
      json.id <%= resource.underscore %>.<%= name %>.id
      json.name <%= resource.underscore %>.<%= name %>.name
    end
  end
<% when "has_many" %>  json.<%= name %> <%= resource.underscore %>.<%= name %>, :id, :name<% end %><% end %>
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
faalis-1.0.0.alpha0 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.26.3 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.26.2 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.26.1 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.26.0 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.25.1 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.25.0 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.24.4 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.24.3 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.24.2 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.24.0 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.23.0 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.22.0 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.21.1 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.21.0 lib/generators/faalis/templates/views/index.json.jbuilder.erb
faalis-0.20.0 lib/generators/faalis/templates/views/index.json.jbuilder.erb