mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove all references to attr_accessible/protected and old mass_assignment_sanitizers
This commit is contained in:
parent
52aa5343f4
commit
d695fdbd11
6 changed files with 0 additions and 33 deletions
|
@ -46,11 +46,6 @@ module <%= app_const_base %>
|
||||||
# like if you have constraints or database-specific column types.
|
# like if you have constraints or database-specific column types.
|
||||||
# config.active_record.schema_format = :sql
|
# config.active_record.schema_format = :sql
|
||||||
|
|
||||||
# Enforce whitelist mode for mass assignment.
|
|
||||||
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
|
||||||
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
|
||||||
# parameters by using an attr_accessible or attr_protected declaration.
|
|
||||||
<%= comment_if :skip_active_record %>config.active_record.whitelist_attributes = true
|
|
||||||
<% unless options.skip_sprockets? -%>
|
<% unless options.skip_sprockets? -%>
|
||||||
|
|
||||||
# Enable the asset pipeline.
|
# Enable the asset pipeline.
|
||||||
|
|
|
@ -23,9 +23,6 @@
|
||||||
config.action_dispatch.best_standards_support = :builtin
|
config.action_dispatch.best_standards_support = :builtin
|
||||||
|
|
||||||
<%- unless options.skip_active_record? -%>
|
<%- unless options.skip_active_record? -%>
|
||||||
# Raise exception on mass assignment protection for Active Record models.
|
|
||||||
config.active_record.mass_assignment_sanitizer = :strict
|
|
||||||
|
|
||||||
# Log the query plan for queries taking more than this (works
|
# Log the query plan for queries taking more than this (works
|
||||||
# with SQLite, MySQL, and PostgreSQL).
|
# with SQLite, MySQL, and PostgreSQL).
|
||||||
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
||||||
|
|
|
@ -31,11 +31,6 @@
|
||||||
# ActionMailer::Base.deliveries array.
|
# ActionMailer::Base.deliveries array.
|
||||||
config.action_mailer.delivery_method = :test
|
config.action_mailer.delivery_method = :test
|
||||||
|
|
||||||
<%- unless options.skip_active_record? -%>
|
|
||||||
# Raise exception on mass assignment protection for Active Record models.
|
|
||||||
config.active_record.mass_assignment_sanitizer = :strict
|
|
||||||
<%- end -%>
|
|
||||||
|
|
||||||
# Print deprecation notices to the stderr.
|
# Print deprecation notices to the stderr.
|
||||||
config.active_support.deprecation = :stderr
|
config.active_support.deprecation = :stderr
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ class LoadingTest < ActiveSupport::TestCase
|
||||||
app_file "app/models/post.rb", <<-MODEL
|
app_file "app/models/post.rb", <<-MODEL
|
||||||
class Post < ActiveRecord::Base
|
class Post < ActiveRecord::Base
|
||||||
validates_acceptance_of :title, :accept => "omg"
|
validates_acceptance_of :title, :accept => "omg"
|
||||||
attr_accessible :title
|
|
||||||
end
|
end
|
||||||
MODEL
|
MODEL
|
||||||
|
|
||||||
|
|
|
@ -343,15 +343,6 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_generated_environments_file_for_sanitizer
|
|
||||||
run_generator [destination_root, "--skip-active-record"]
|
|
||||||
%w(development test).each do |env|
|
|
||||||
assert_file "config/environments/#{env}.rb" do |file|
|
|
||||||
assert_no_match(/config.active_record.mass_assignment_sanitizer = :strict/, file)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_generated_environments_file_for_auto_explain
|
def test_generated_environments_file_for_auto_explain
|
||||||
run_generator [destination_root, "--skip-active-record"]
|
run_generator [destination_root, "--skip-active-record"]
|
||||||
%w(development production).each do |env|
|
%w(development production).each do |env|
|
||||||
|
|
|
@ -328,14 +328,4 @@ class ModelGeneratorTest < Rails::Generators::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_attr_accessible_added_with_non_reference_attributes
|
|
||||||
run_generator
|
|
||||||
assert_file 'app/models/account.rb', /attr_accessible :age, :name/
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_attr_accessible_added_with_comments_when_no_attributes_present
|
|
||||||
run_generator ["Account"]
|
|
||||||
assert_file 'app/models/account.rb', /# attr_accessible :title, :body/
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue