Sha256: 6c2b90b618be7d4180b8808c039082507ed4100300dc1e438a0672e0190c34b0

Contents?: true

Size: 854 Bytes

Versions: 2

Compression:

Stored size: 854 Bytes

Contents

# ForeignKeyChecker
This gem checks `belongs_to` ActiveRecord relations. It finds
1. Nonpolymorphic relations without a `foreign_key`
2. records without a record in related table (example: `city_id` is 1000, but there is not city with id 1000)
3. broken relations: if you try to join such relation (example: `City.joins(:country)`), there is an exception.

## Usage
```bash
bundle exec rake foreign_key_check
```

Or use it inside your application
```ruby
ForeignKeyChecker.check.each do |key, result|
  ...
end
```

## Installation
Add this line to your application's Gemfile:

```ruby
gem 'foreign_key_checker'
```

And then execute:
```bash
$ bundle
```

Or install it yourself as:
```bash
$ gem install foreign_key_checker
```

## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreign_key_checker-0.1.1 README.md
foreign_key_checker-0.1.0 README.md