I would suggest you include the module
for every model you want. What you are doing is monkey-patching ActiveRecord
which is not a good idea.
UPDATE
Here is a solution where you can include ActiveModel::ForbiddenAttributesProtection
only for models you like. Put the code in an initializer.
all_models = Dir["#{Rails.root}/app/models/**/*.rb"].map do |filename|
filename[/(?<=models\/).*(?=\.rb)/].camelize.constantize
end
models_without_forbidden_attributes_protection = [Foo] # put your filtered classes here
all_models.each do |model|
unless models_without_forbidden_attributes_protection.include?(model)
model.send(:include, ActiveModel::ForbiddenAttributesProtection)
end
end