gregbell/active_admin

View on GitHub
lib/generators/active_admin/resource/templates/resource.rb.erb

Summary

Maintainability
Test Coverage
ActiveAdmin.register <%= class_name %> do
  # Specify parameters which should be permitted for assignment
  permit_params <%= permit_params %>

  # or consider:
  #
  # permit_params do
  #   permitted = [<%= permit_params %>]
  #   permitted << :other if params[:action] == 'create' && current_user.admin?
  #   permitted
  # end

  # For security, limit the actions that should be available
  actions :all, except: []

  # Add or remove filters to toggle their visibility
  <%= filters %>

  # Add or remove columns to toggle their visibility in the index action
  index do
    selectable_column
    id_column
    <%= columns %>
    actions
  end

  # Add or remove rows to toggle their visibility in the show action
  show do
    attributes_table_for(resource) do
      <%= rows %>
    end
  end

  # Add or remove fields to toggle their visibility in the form
  form do |f|
    f.semantic_errors(*f.object.errors.attribute_names)
    f.inputs do
      <%= form_inputs %>
    end
    f.actions
  end
end