activerecord-ignored_columns
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.
- Fork the repository
- Create a feature branch:
git checkout -b add-new-feature
- Commit your changes:
git commit -am 'Add new feature'
- Push the branch:
git push origin add-new-feature
- Send us a pull request
License
The gem is available as open source under the terms of the MIT License.