Rails helper for rendering an AR model or iterable collection of AR models as an HTML table
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rubocop.yml
.travis.yml
Gemfile
Gemfile.lock
MIT-LICENSE
README.md
Rakefile
docket.gemspec

README.md

Build Status Coverage Status

Docket

Overview

Adds a docket helper to a Rails project for rendering an AR model or iterable collection of models as an HTML table.

Usage

From your Rails view call docket with the following:

  • model: An AR model instance or collection of models to render in a table.
  • ignore (optional): An array of symbols which map to model attributes which won't be rendered in the table.
  • calls (optional): An array of strings which map to methods to call against the instance.
  • table_class (optional): Class attribute to use for the table.
  • table_id (optional): ID attribute to use for the table.
  • table_style (optional): Style attribute to use for the table.

Example

<%= docket @users, 
    ignore: [:updated_at, :created at],
    calls: [['fullname'], ['is_admin.humanize', 'Is Admin?']],
    table_class: 'tablesorter',
    table_id: 'user',
    table_style: 'background-color: white'
%>

License

MIT-LICENSE.