Sha256: c58b7786878af8ac5a6d72ff17890046edf9502d4c240cc277664106bbad6c4c
Contents?: true
Size: 978 Bytes
Versions: 1
Compression:
Stored size: 978 Bytes
Contents
# Extension of StandardHelper functionality to provide a set of default # attributes for the current model to be used in tables and forms. This helper # is included in CrudController. module ListHelper # Create a table of the @entries variable with the default or # the passed attributes in its columns. An options hash may be given # as the last argument. def list_table(*attrs, &block) options = attrs.extract_options! # only use default attrs if no attrs and no block are given attributes = (block_given? || attrs.present?) ? attrs : default_attrs table(@entries, options) do |t| t.sortable_attrs(*attributes) yield t if block_given? end end # The default attributes to use in attrs, list and form partials. # These are all defined attributes except certain special ones like 'id' or 'position'. def default_attrs attrs = model_class.column_names.collect(&:to_sym) attrs - [:id, :position, :password] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry_crud-1.5.0 | lib/generators/dry_crud/templates/app/helpers/list_helper.rb |