Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dhyegocalota/active_record-nested_error_indexer
Monkey patch to index nested errors for ActiveRecord 4
https://github.com/dhyegocalota/active_record-nested_error_indexer
Last synced: 2 days ago
JSON representation
Monkey patch to index nested errors for ActiveRecord 4
- Host: GitHub
- URL: https://github.com/dhyegocalota/active_record-nested_error_indexer
- Owner: dhyegocalota
- License: mit
- Created: 2018-01-26T17:20:54.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-26T19:16:41.000Z (almost 7 years ago)
- Last Synced: 2024-03-19T02:56:05.803Z (8 months ago)
- Language: Ruby
- Size: 105 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ActiveRecord Nested Error Indexer
In Rails 5, we have the option `index_errors: true` to output the nested item index for errors like this:```ruby
class Order < ApplicationRecord
has_many :items, index_errors: trueaccepts_nested_attributes_for :items
endorder = Order.create(items_attributes: [{ price: 1 }, { price: -1 }])
order.errors # #
```BUT IT DOESN'T WORK FOR RAILS 4, so... *let's monkey patch it :)*
## Installation
Include to your Gemfile
```ruby
gem 'active_record-nested_error_indexer'
```## Maintainer
[Dhyego Fernando](https://github.com/dhyegofernando)