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

Rails 3.0+ Compatibility #13

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+7 −5
Split
@@ -29,7 +29,7 @@ def permit!
def require(key)
self[key].presence || raise(ActionController::ParameterMissing.new(key))
end
-
+
alias :required :require
def permit(*filters)
@@ -75,7 +75,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(*args)
+ new_attributes = args.first
if !new_attributes.respond_to?(:permitted?) || (new_attributes.respond_to?(:permitted?) && new_attributes.permitted?)
super
else
@@ -14,8 +14,8 @@ 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.2.0"
- s.add_dependency "activemodel", ">= 3.2.0"
+ s.add_dependency "actionpack", ">= 3"
+ s.add_dependency "activemodel", ">= 3"
s.add_development_dependency "rake"
end