Sha256: 6cf4b4d8845022ef185fd497890a29e48b13780593232f353fba1b5eefe73fd2

Contents?: true

Size: 939 Bytes

Versions: 60

Compression:

Stored size: 939 Bytes

Contents

module <%= controller_class %>Helper

  def render_api_<%= model_name_underscored %>(api, <%= model_name_underscored %>)
    api.<%= model_name_underscored %> do
      api.id <%= model_name_underscored %>.id
      <%- db_columns.keys.each do |column_name| -%>
      api.<%= column_name %> <%= model_name_underscored %>.<%= column_name %>
      <%- end -%>
      <%- if acts_as_customizable? -%>
      render_api_custom_values <%= model_name_underscored %>.visible_custom_field_values, api
      <%- end -%>
      <%- if acts_as_attachable? -%>
      api.array :attachments do
        <%= model_name_underscored %>.attachments.each do |attachment|
          render_api_attachment(attachment, api)
        end
      end if include_in_api_response?('attachments')
      <%- end -%>

      call_hook(:helper_render_api_<%= model_name_underscored %>, {api: api, <%= model_name_underscored %>: <%= model_name_underscored %>})
    end
  end

end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
redmine_extensions-0.3.00 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.16 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.14 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.13 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.12 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.11 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.10 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.9 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.8 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.7 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.6 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.5 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.4 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.3 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.2 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.2.0 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.1.27 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.1.26 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.1.25 lib/generators/redmine_extensions/entity/templates/helper.rb.erb
redmine_extensions-0.1.24 lib/generators/redmine_extensions/entity/templates/helper.rb.erb