scoped_attr_accessible 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -15,6 +15,9 @@ To use, just add to any application using ActiveModel. In Rails 3, this is a sim
15
15
 
16
16
  To our Gemfile and running `bundle install`.
17
17
 
18
+ If you encounter issues, please make sure you add it right after activerecord or rails - Otherwise, you might
19
+ encounter issues where the process it uses to hook into ActiveModel fails.
20
+
18
21
  ## Usage
19
22
 
20
23
  With it enabled, your application should continue to work as usual with classic `attr_accessible` and `attr_protected`.
@@ -108,7 +111,7 @@ match. e.g:
108
111
  class User < ActiveRecord::Base
109
112
 
110
113
  sanitizer_scope_recognizer :admin do |record, scope_value|
111
- scope_value.is_a?(User) && user.admin?
114
+ scope_value.is_a?(User) && scope_value.admin?
112
115
  end
113
116
 
114
117
  sanitizer_scope_recognizer :owner do |record, scope_value|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -85,7 +85,7 @@ module ScopedAttrAccessible
85
85
  module InstanceMethods
86
86
 
87
87
  def current_sanitizer_scope
88
- @current_sanitizer_scope || self.class.current_sanitizer_scope || :default
88
+ @current_sanitizer_scope || self.class.current_sanitizer_scope
89
89
  end
90
90
 
91
91
  def current_sanitizer_scope=(value)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{scoped_attr_accessible}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Darcy Laycock", "Mario Visic"]
12
- s.date = %q{2010-10-13}
12
+ s.date = %q{2010-10-15}
13
13
  s.description = %q{scoped_attr_accessible is a plugin that makes it easy to scope the `attr_accessible` and `attr_protected`
14
14
  methods on any library using ActiveModel's MassAssignmentSecurity module.}
15
15
  s.email = %q{team+darcy+mario@thefrontiergroup.com.au}
@@ -155,7 +155,7 @@ describe ScopedAttrAccessible::ActiveModelMixin do
155
155
  it 'should fallback to default if no scope is set' do
156
156
  subject_instance.current_sanitizer_scope = nil
157
157
  subject.current_sanitizer_scope = nil
158
- subject_instance.current_sanitizer_scope.should == :default
158
+ subject_instance.current_sanitizer_scope.should == nil
159
159
  end
160
160
 
161
161
  it 'should let you assign the instance level scope' do
@@ -7,7 +7,7 @@ module CustomMatchers
7
7
 
8
8
  def matches?(target)
9
9
  @target_attributes = target.keys.map(&:to_s)
10
- @target_attributes == @attributes
10
+ (@target_attributes & @attributes) == @target_attributes
11
11
  end
12
12
 
13
13
  def failure_message_for_should
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoped_attr_accessible
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Darcy Laycock
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-13 00:00:00 +08:00
19
+ date: 2010-10-15 00:00:00 +08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency