Skip to content
This repository has been archived by the owner on Aug 17, 2017. It is now read-only.

Commit

Permalink
Rails 3.0+ Compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
joslynesser committed Mar 31, 2012
1 parent 1e238a2 commit 42b5300
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/action_controller/parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def permit!
def require(key)
self[key].presence || raise(ActionController::ParameterMissing.new(key))
end

alias :required :require

def permit(*filters)
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion lib/active_model/forbidden_attributes_protection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions strong_parameters.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 42b5300

Please sign in to comment.