Skip to content

Commit

Permalink
Remove all references to attr_accessible/protected and old mass_assig…
Browse files Browse the repository at this point in the history
…nment_sanitizers
  • Loading branch information
guilleiguaran committed Sep 17, 2012
1 parent 52aa534 commit d695fdb
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 33 deletions.
Expand Up @@ -46,11 +46,6 @@ class Application < Rails::Application
# 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.
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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


Expand Down
1 change: 0 additions & 1 deletion railties/test/application/loading_test.rb
Expand Up @@ -20,7 +20,6 @@ def app
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


Expand Down
9 changes: 0 additions & 9 deletions railties/test/generators/app_generator_test.rb
Expand Up @@ -343,15 +343,6 @@ def test_new_hash_style
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|
Expand Down
10 changes: 0 additions & 10 deletions railties/test/generators/model_generator_test.rb
Expand Up @@ -328,14 +328,4 @@ def test_index_is_skipped_for_references_association
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

0 comments on commit d695fdb

Please sign in to comment.