activerecord-ignored_columns

Gem Version Build Status Code Climate Test Coverage

activerecord-ignored_columns is a backport of ActiveRecord::Base.ignored_columns (introduced in Rails 5) into Rails 4.
You can also use this gem for Rails 5.0 because it fixes one serious bug in the version (see PR #30980).

Installation

Add this line to your application's Gemfile:

gem 'activerecord-ignored_columns'

And then execute:

$ bundle

Usage

Set columns names that a model should ignore as follows:

class UserProfile < ActiveRecord::Base
  self.ignored_columns = %i(full_name)
end

Ignored columns won't have attribute accessors defined, and won't be referenced in SQL queries.

Contributing

You should follow the steps below.

  1. Fork the repository
  2. Create a feature branch: git checkout -b add-new-feature
  3. Commit your changes: git commit -am 'Add new feature'
  4. Push the branch: git push origin add-new-feature
  5. Send us a pull request

License

The gem is available as open source under the terms of the MIT License.