https://github.com/buren/action_table
Render ActiveRecord objects as HTML tables with one line of Ruby.
https://github.com/buren/action_table
actionview rails rubygems
Last synced: about 2 months ago
JSON representation
Render ActiveRecord objects as HTML tables with one line of Ruby.
- Host: GitHub
- URL: https://github.com/buren/action_table
- Owner: buren
- License: mit
- Created: 2018-08-03T00:10:52.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-11-29T11:51:26.000Z (over 3 years ago)
- Last Synced: 2025-03-24T00:26:31.000Z (2 months ago)
- Topics: actionview, rails, rubygems
- Language: Ruby
- Homepage:
- Size: 27.3 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ActionTable
Render ActiveRecord objects as HTML tables with one line of Ruby - supports some simple configuration options.
:warning: Only works with Ruby on Rails.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'action_table'
```And then execute:
```
$ bundle
```Or install it yourself as:
```
$ gem install action_table
```## Usage
Generate table with `name` and `created_at` columns.
```
<%= action_table User.all, %i[name created_at] %>
```Add bootstrap classes to table
```
<%= action_table User.all, %i[name created_at], styles: %i[hover striped] %>
```Configure the default styles
```ruby
ActionTable.configure do |config|
config.table_styles = %i[striped bordered]
end
```## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/buren/action_table.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).