load_and_authorize_resource 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d100862ae9989dca78c691aa64a0d90a6d83a9ba
4
+ data.tar.gz: 099554f61664a23b04777e63bde6d72cd6292ca3
5
+ SHA512:
6
+ metadata.gz: 29d9d44c2b79b4819e87ec48fa316ba96231e37a6c31bcc164981bc73e9d1dde159557293bba8ac68652e1b9dd1895b211d0583271aba3926a5492a81abc8084
7
+ data.tar.gz: 23eeef62e7a7e65656b54c174ce9d90a0fc3a22c5a1b75b43e11e9170da513c0dde08b853610032abc80a88f8447ecf0975b085bc725c26fd2d5bf5192f02da8
data/README.md CHANGED
@@ -111,9 +111,9 @@ class NotesController < ApplicationController
111
111
 
112
112
  def notes
113
113
  if @person
114
- @person.notes.scoped
114
+ @person.notes
115
115
  elsif !required(:parent)
116
- Note.scoped
116
+ Note.all
117
117
  end
118
118
  end
119
119
  end
@@ -146,7 +146,7 @@ class NotesController < ApplicationController
146
146
  end
147
147
  ```
148
148
 
149
- Instead of asking `current_user.can_read?(person)`, LARR will ask `current_user.can_edit?(person)`.
149
+ Instead of asking `current_user.can_read?(person)`, LAAR will ask `current_user.can_edit?(person)`.
150
150
 
151
151
  ### Shallow (Optional) Routes
152
152
 
@@ -88,9 +88,9 @@ module LoadAndAuthorizeResource
88
88
  #
89
89
  # def notes
90
90
  # if @person
91
- # @person.notes.scoped
91
+ # @person.notes.all
92
92
  # elsif not required(:person)
93
- # Note.scoped
93
+ # Note.all
94
94
  # end
95
95
  # end
96
96
  # end
@@ -103,7 +103,7 @@ module LoadAndAuthorizeResource
103
103
  # end
104
104
  #
105
105
  # This will create a private method called "people" that either returns
106
- # `@group.people.scoped` or Person.scoped (only if @group is optional).
106
+ # `@group.people.all` or Person.all (only if @group is optional).
107
107
  #
108
108
  # @param names [Array<String, Symbol>] one or more names of resources in lower case
109
109
  # @option options [Boolean] :optional set to true to allow non-nested routes, e.g. `/notes` in addition to `/people/1/notes`
@@ -221,7 +221,7 @@ module LoadAndAuthorizeResource
221
221
  protected
222
222
 
223
223
  # Defines a method with the same name as the resource (`notes` for the NotesController)
224
- # that returns a scoped relation, either @parent.notes, or Note itself.
224
+ # that returns a relation, either @parent.notes, or Note itself.
225
225
  def define_scope_method(parents, name=nil)
226
226
  name ||= resource_accessor_name
227
227
  self.nested_resource_options ||= {}
@@ -231,10 +231,10 @@ module LoadAndAuthorizeResource
231
231
  define_method(name) do
232
232
  parents.each do |parent|
233
233
  if resource = instance_variable_get("@#{parent}")
234
- return resource.send(name).scoped
234
+ return resource.send(name)
235
235
  end
236
236
  end
237
- name.to_s.classify.constantize.scoped
237
+ name.to_s.classify.constantize.all
238
238
  end
239
239
  private(name)
240
240
  end
metadata CHANGED
@@ -1,78 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: load_and_authorize_resource
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.3.1
4
+ version: 0.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tim Morgan
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-29 00:00:00.000000000 Z
11
+ date: 2014-05-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- prerelease: false
16
- type: :runtime
17
14
  name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
18
22
  version_requirements: !ruby/object:Gem::Requirement
19
- none: false
20
23
  requirements:
21
- - - ! '>='
24
+ - - '>='
22
25
  - !ruby/object:Gem::Version
23
- version: '3.0'
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-rails
24
29
  requirement: !ruby/object:Gem::Requirement
25
- none: false
26
30
  requirements:
27
- - - ! '>='
31
+ - - '>='
28
32
  - !ruby/object:Gem::Version
29
- version: '3.0'
30
- - !ruby/object:Gem::Dependency
31
- prerelease: false
33
+ version: '0'
32
34
  type: :development
33
- name: rspec-rails
35
+ prerelease: false
34
36
  version_requirements: !ruby/object:Gem::Requirement
35
- none: false
36
37
  requirements:
37
- - - ! '>='
38
+ - - '>='
38
39
  - !ruby/object:Gem::Version
39
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
40
43
  requirement: !ruby/object:Gem::Requirement
41
- none: false
42
44
  requirements:
43
- - - ! '>='
45
+ - - '>='
44
46
  - !ruby/object:Gem::Version
45
47
  version: '0'
46
- - !ruby/object:Gem::Dependency
47
- prerelease: false
48
48
  type: :development
49
- name: yard
49
+ prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
- none: false
52
51
  requirements:
53
- - - ! '>='
52
+ - - '>='
54
53
  - !ruby/object:Gem::Version
55
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
56
57
  requirement: !ruby/object:Gem::Requirement
57
- none: false
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
- - !ruby/object:Gem::Dependency
63
- prerelease: false
64
62
  type: :development
65
- name: redcarpet
63
+ prerelease: false
66
64
  version_requirements: !ruby/object:Gem::Requirement
67
- none: false
68
65
  requirements:
69
- - - ! '>='
66
+ - - '>='
70
67
  - !ruby/object:Gem::Version
71
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: redcarpet
72
71
  requirement: !ruby/object:Gem::Requirement
73
- none: false
74
72
  requirements:
75
- - - ! '>='
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
76
81
  - !ruby/object:Gem::Version
77
82
  version: '0'
78
83
  description:
@@ -86,27 +91,26 @@ files:
86
91
  homepage: https://github.com/seven1m/load_and_authorize_resource
87
92
  licenses:
88
93
  - MIT
94
+ metadata: {}
89
95
  post_install_message:
90
96
  rdoc_options: []
91
97
  require_paths:
92
98
  - lib
93
99
  required_ruby_version: !ruby/object:Gem::Requirement
94
- none: false
95
100
  requirements:
96
- - - ! '>='
101
+ - - '>='
97
102
  - !ruby/object:Gem::Version
98
103
  version: '0'
99
104
  required_rubygems_version: !ruby/object:Gem::Requirement
100
- none: false
101
105
  requirements:
102
- - - ! '>='
106
+ - - '>='
103
107
  - !ruby/object:Gem::Version
104
108
  version: '0'
105
109
  requirements: []
106
110
  rubyforge_project:
107
- rubygems_version: 1.8.25
111
+ rubygems_version: 2.2.2
108
112
  signing_key:
109
- specification_version: 3
110
- summary: Auto-loads and authorizes resources in your controllers in Rails 3 and up.
113
+ specification_version: 4
114
+ summary: Auto-loads and authorizes resources in your controllers in Rails 4 and up.
111
115
  test_files: []
112
116
  has_rdoc: yard