Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[3-2-stable] Fix build #5278

Merged
merged 2 commits into from

2 participants

@rafaelfranca
Owner

No description provided.

@NZKoz NZKoz merged commit ebc5a19 into rails:3-2-stable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 5, 2012
  1. @rafaelfranca

    Only add the whitelist_attributes option if ActiveRecord is present

    rafaelfranca authored
    Conflicts:
    
    	railties/test/generators/app_generator_test.rb
    	railties/test/isolation/abstract_unit.rb
  2. @rafaelfranca
This page is out of date. Refresh to see the latest.
View
2  railties/lib/rails/generators/rails/app/templates/config/application.rb
@@ -58,7 +58,7 @@ class Application < Rails::Application
# 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.
- config.active_record.whitelist_attributes = true
+ <%= comment_if :skip_active_record %>config.active_record.whitelist_attributes = true
<% unless options.skip_sprockets? -%>
# Enable the asset pipeline
View
1  railties/test/application/loading_test.rb
@@ -20,6 +20,7 @@ def app
app_file "app/models/post.rb", <<-MODEL
class Post < ActiveRecord::Base
validates_acceptance_of :title, :accept => "omg"
+ attr_accessible :title
end
MODEL
View
6 railties/test/generators/app_generator_test.rb
@@ -210,6 +210,7 @@ def test_generator_if_skip_active_record_is_given
run_generator [destination_root, "--skip-active-record"]
assert_no_file "config/database.yml"
assert_file "config/application.rb", /#\s+require\s+["']active_record\/railtie["']/
+ assert_file "config/application.rb", /#\s+config\.active_record\.whitelist_attributes = true/
assert_file "test/test_helper.rb" do |helper_content|
assert_no_match(/fixtures :all/, helper_content)
end
@@ -375,6 +376,11 @@ def test_generated_environments_file_for_auto_explain
end
end
+ def test_active_record_whitelist_attributes_is_present_application_config
+ run_generator
+ assert_file "config/application.rb", /config\.active_record\.whitelist_attributes = true/
+ end
+
protected
def action(*args, &block)
View
2  railties/test/isolation/abstract_unit.rb
@@ -260,7 +260,7 @@ def use_frameworks(arr)
:activemodel,
:activerecord,
:activeresource] - arr
- remove_from_config "config.active_record.identity_map = true" if to_remove.include? :activerecord
+ remove_from_config "config.active_record.whitelist_attributes = true" if to_remove.include? :activerecord
$:.reject! {|path| path =~ %r'/(#{to_remove.join('|')})/' }
end
Something went wrong with that request. Please try again.