This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge pull request #61 from grosser/rails30

support and test rails 3.0
  • Loading branch information...
2 parents 8cd920b + 3e03b9c commit 3996cf86a1a4b5b3ac2ef3f56e219042b30fe21e @rafaelfranca rafaelfranca committed Nov 16, 2012
View
@@ -6,6 +6,7 @@ rvm:
- 1.9.3
gemfile:
+ - test/gemfiles/Gemfile.rails-3.0.x
- test/gemfiles/Gemfile.rails-3.1.x
- test/gemfiles/Gemfile.rails-3.2.x
View
@@ -2,9 +2,9 @@ PATH
remote: .
specs:
strong_parameters (0.1.6.dev)
- actionpack (~> 3.1)
- activemodel (~> 3.1)
- railties (~> 3.1)
+ actionpack (~> 3.0)
+ activemodel (~> 3.0)
+ railties (~> 3.0)
GEM
remote: http://rubygems.org/
@@ -34,7 +34,7 @@ GEM
metaclass (0.0.1)
mocha (0.12.0)
metaclass (~> 0.0.1)
- multi_json (1.3.6)
+ multi_json (1.3.7)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
View
@@ -52,8 +52,8 @@ If you want to now disable the default whitelisting that occurs in later version
config.active_record.whitelist_attributes = false
-This will allow you to remove / not have to use +attr_accessible+ and do mass assignment inside your code and tests.
+This will allow you to remove / not have to use +attr_accessible+ and do mass assignment inside your code and tests.
== Compatibility
-This plugin is only fully compatible with Rails versions 3.1 and 3.2 but not 4.0+, as it is part of Rails Core in 4.0.
+This plugin is only fully compatible with Rails versions 3.0, 3.1 and 3.2 but not 4.0+, as it is part of Rails Core in 4.0.
@@ -83,7 +83,8 @@ def slice(*keys)
end
def dup
- super.tap do |duplicate|
+ self.class.new(self).tap do |duplicate|
+ duplicate.default = default
duplicate.instance_variable_set :@permitted, @permitted
end
end
@@ -3,7 +3,8 @@ class ForbiddenAttributes < StandardError
end
module ForbiddenAttributesProtection
- def sanitize_for_mass_assignment(new_attributes, options = {})
+ def sanitize_for_mass_assignment(*options)
+ new_attributes = options.first
if !new_attributes.respond_to?(:permitted?) || new_attributes.permitted?
super
else
@@ -1,10 +1,17 @@
+require 'rails/version'
require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
module Rails
module Generators
class StrongParametersControllerGenerator < ScaffoldControllerGenerator
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
source_root File.expand_path("../templates", __FILE__)
+
+ if ::Rails::VERSION::STRING < '3.1'
+ def module_namespacing
+ yield if block_given?
+ end
+ end
end
end
end
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
- s.add_dependency "actionpack", "~> 3.1"
- s.add_dependency "activemodel", "~> 3.1"
- s.add_dependency "railties", "~> 3.1"
+ s.add_dependency "actionpack", "~> 3.0"
+ s.add_dependency "activemodel", "~> 3.0"
+ s.add_dependency "railties", "~> 3.0"
s.add_development_dependency "rake"
s.add_development_dependency "mocha", "~> 0.12.0"
@@ -0,0 +1,6 @@
+source :rubygems
+gemspec :path => "./../.."
+
+gem "actionpack", "~> 3.0.0"
+gem "railties", "~> 3.0.0"
+gem "activemodel", "~> 3.0.0"
@@ -0,0 +1,62 @@
+PATH
+ remote: /Users/mgrosser/code/tools/strong_parameters
+ specs:
+ strong_parameters (0.1.6.dev)
+ actionpack (~> 3.0)
+ activemodel (~> 3.0)
+ railties (~> 3.0)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionpack (3.0.17)
+ activemodel (= 3.0.17)
+ activesupport (= 3.0.17)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.5.0)
+ rack (~> 1.2.5)
+ rack-mount (~> 0.6.14)
+ rack-test (~> 0.5.7)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.17)
+ activesupport (= 3.0.17)
+ builder (~> 2.1.2)
+ i18n (~> 0.5.0)
+ activesupport (3.0.17)
+ builder (2.1.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ i18n (0.5.0)
+ json (1.7.5)
+ metaclass (0.0.1)
+ mocha (0.12.7)
+ metaclass (~> 0.0.1)
+ rack (1.2.5)
+ rack-mount (0.6.14)
+ rack (>= 1.0.0)
+ rack-test (0.5.7)
+ rack (>= 1.0)
+ railties (3.0.17)
+ actionpack (= 3.0.17)
+ activesupport (= 3.0.17)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.4)
+ rake (10.0.1)
+ rdoc (3.12)
+ json (~> 1.4)
+ thor (0.14.6)
+ tzinfo (0.3.35)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ actionpack (~> 3.0.0)
+ activemodel (~> 3.0.0)
+ mocha (~> 0.12.0)
+ railties (~> 3.0.0)
+ rake
+ strong_parameters!

0 comments on commit 3996cf8

Please sign in to comment.