module ActiveRecord::ModelSchema::ClassMethods

def ignored_columns=(columns)

user.category # => raises NoMethodError
user = Project.create!(name: "First Project")

column are removed (automated tests can help you find any usages).
You will get an error if accessing that attribute directly, so ensure all usages of the

Project.columns_hash["category"] => nil

schema caching will not attempt to use the column:
The schema still contains "category", but now the model omits it, so any meta-driven code or

end
self.ignored_columns = [:category]

# category :string, limit: 255
# name :string, limit: 255
# id :bigint
# schema:
class Project < ActiveRecord::Base

as ignored:
For example, given a model where you want to drop the "category" attribute, first mark it

schema migration is run.
is no code that raises errors due to having a cached schema in memory at the time the
has been deployed and run. Using this two step approach to dropping columns ensures there
have been removed and deployed, before a migration to drop the column from the database
A common usage pattern for this method is to ensure all references to an attribute

accessors defined, and won't be referenced in SQL queries.
Sets the columns names the model should ignore. Ignored columns won't have attribute
def ignored_columns=(columns)
  reload_schema_from_cache
  @ignored_columns = columns.map(&:to_s).freeze
end