actionpack 3.1.0.beta1 → 3.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

Files changed (52) hide show
  1. data/CHANGELOG +57 -4
  2. data/README.rdoc +5 -5
  3. data/lib/abstract_controller/base.rb +25 -13
  4. data/lib/abstract_controller/callbacks.rb +2 -2
  5. data/lib/abstract_controller/layouts.rb +3 -3
  6. data/lib/abstract_controller/rendering.rb +22 -6
  7. data/lib/abstract_controller/url_for.rb +6 -0
  8. data/lib/abstract_controller/view_paths.rb +1 -1
  9. data/lib/action_controller/log_subscriber.rb +3 -1
  10. data/lib/action_controller/metal/compatibility.rb +4 -7
  11. data/lib/action_controller/metal/implicit_render.rb +7 -9
  12. data/lib/action_controller/metal/instrumentation.rb +1 -1
  13. data/lib/action_controller/metal/params_wrapper.rb +37 -26
  14. data/lib/action_controller/metal/request_forgery_protection.rb +4 -1
  15. data/lib/action_controller/metal/responder.rb +6 -1
  16. data/lib/action_controller/metal/url_for.rb +21 -0
  17. data/lib/action_controller/test_case.rb +6 -1
  18. data/lib/action_controller/vendor/html-scanner/html/sanitizer.rb +1 -1
  19. data/lib/action_dispatch/http/cache.rb +12 -14
  20. data/lib/action_dispatch/http/rack_cache.rb +6 -2
  21. data/lib/action_dispatch/http/response.rb +41 -15
  22. data/lib/action_dispatch/http/url.rb +1 -1
  23. data/lib/action_dispatch/middleware/cookies.rb +3 -3
  24. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb +1 -1
  25. data/lib/action_dispatch/routing.rb +3 -3
  26. data/lib/action_dispatch/routing/mapper.rb +33 -28
  27. data/lib/action_dispatch/routing/route_set.rb +6 -3
  28. data/lib/action_dispatch/routing/url_for.rb +4 -4
  29. data/lib/action_dispatch/testing/assertions/selector.rb +1 -1
  30. data/lib/action_dispatch/testing/performance_test.rb +6 -13
  31. data/lib/action_dispatch/testing/test_process.rb +1 -1
  32. data/lib/action_pack/version.rb +1 -1
  33. data/lib/action_view.rb +1 -0
  34. data/lib/action_view/base.rb +5 -5
  35. data/lib/action_view/helpers/asset_paths.rb +0 -1
  36. data/lib/action_view/helpers/atom_feed_helper.rb +6 -6
  37. data/lib/action_view/helpers/cache_helper.rb +1 -1
  38. data/lib/action_view/helpers/capture_helper.rb +6 -2
  39. data/lib/action_view/helpers/date_helper.rb +119 -75
  40. data/lib/action_view/helpers/form_helper.rb +26 -36
  41. data/lib/action_view/helpers/form_options_helper.rb +2 -2
  42. data/lib/action_view/helpers/form_tag_helper.rb +6 -6
  43. data/lib/action_view/helpers/translation_helper.rb +4 -4
  44. data/lib/action_view/helpers/url_helper.rb +1 -1
  45. data/lib/action_view/lookup_context.rb +5 -5
  46. data/lib/action_view/path_set.rb +1 -1
  47. data/lib/action_view/template.rb +5 -5
  48. data/lib/action_view/template/error.rb +2 -0
  49. data/lib/action_view/template/handlers/erb.rb +0 -1
  50. data/lib/action_view/template/resolver.rb +37 -25
  51. data/lib/sprockets/railtie.rb +3 -3
  52. metadata +8 -8
@@ -73,7 +73,10 @@ module ActionController #:nodoc:
73
73
  protected
74
74
  # The actual before_filter that is used. Modify this to change how you handle unverified requests.
75
75
  def verify_authenticity_token
76
- verified_request? || handle_unverified_request
76
+ unless verified_request?
77
+ logger.debug "WARNING: Can't verify CSRF token authenticity" if logger
78
+ handle_unverified_request
79
+ end
77
80
  end
78
81
 
79
82
  def handle_unverified_request
@@ -68,7 +68,7 @@ module ActionController #:nodoc:
68
68
  # respond_with(@project, @task)
69
69
  # end
70
70
  #
71
- # Giving an array of resources, you ensure that the responder will redirect to
71
+ # Giving several resources ensures that the responder will redirect to
72
72
  # <code>project_task_url</code> instead of <code>task_url</code>.
73
73
  #
74
74
  # Namespaced and singleton resources require a symbol to be given, as in
@@ -77,6 +77,11 @@ module ActionController #:nodoc:
77
77
  #
78
78
  # respond_with(@project, :manager, @task)
79
79
  #
80
+ # Note that if you give an array, it will be treated as a collection,
81
+ # so the following is not equivalent:
82
+ #
83
+ # respond_with [@project, :manager, @task]
84
+ #
80
85
  # === Custom options
81
86
  #
82
87
  # <code>respond_with</code> also allow you to pass options that are forwarded
@@ -1,3 +1,24 @@
1
+ # Includes +url_for+ into the host class. The class has to provide a +RouteSet+ by implementing
2
+ # the <tt>_routes</tt> method. Otherwise, an exception will be raised.
3
+ #
4
+ # In addition to <tt>AbstractController::UrlFor</tt>, this module accesses the HTTP layer to define
5
+ # url options like the +host+. In order to do so, this module requires the host class
6
+ # to implement +env+ and +request+, which need to be a Rack-compatible.
7
+ #
8
+ # Example:
9
+ #
10
+ # class RootUrl
11
+ # include ActionController::UrlFor
12
+ # include Rails.application.routes.url_helpers
13
+ #
14
+ # delegate :env, :request, :to => :controller
15
+ #
16
+ # def initialize(controller)
17
+ # @controller = controller
18
+ # @url = root_path # named route from the application.
19
+ # end
20
+ # end
21
+ # =>
1
22
  module ActionController
2
23
  module UrlFor
3
24
  extend ActiveSupport::Concern
@@ -2,6 +2,7 @@ require 'rack/session/abstract/id'
2
2
  require 'active_support/core_ext/object/blank'
3
3
  require 'active_support/core_ext/object/to_query'
4
4
  require 'active_support/core_ext/class/attribute'
5
+ require 'active_support/core_ext/module/anonymous'
5
6
 
6
7
  module ActionController
7
8
  module TemplateAssertions
@@ -413,7 +414,11 @@ module ActionController
413
414
  @request.env['REQUEST_METHOD'] = http_method
414
415
 
415
416
  parameters ||= {}
416
- @request.assign_parameters(@routes, @controller.class.name.underscore.sub(/_controller$/, ''), action.to_s, parameters)
417
+ controller_class_name = @controller.class.anonymous? ?
418
+ "anonymous_controller" :
419
+ @controller.class.name.underscore.sub(/_controller$/, '')
420
+
421
+ @request.assign_parameters(@routes, controller_class_name, action.to_s, parameters)
417
422
 
418
423
  @request.session = ActionController::TestSession.new(session) if session
419
424
  @request.session["flash"] = @request.flash.update(flash || {})
@@ -33,7 +33,7 @@ module HTML
33
33
  result = super
34
34
  # strip any comments, and if they have a newline at the end (ie. line with
35
35
  # only a comment) strip that too
36
- result.gsub!(/<!--(.*?)-->[\n]?/m, "") if result
36
+ result = result.gsub(/<!--(.*?)-->[\n]?/m, "") if (result && result =~ /<!--(.*?)-->[\n]?/m)
37
37
  # Recurse - handle all dirty nested tags
38
38
  result == text ? result : sanitize(result, options)
39
39
  end
@@ -42,20 +42,6 @@ module ActionDispatch
42
42
  attr_reader :cache_control, :etag
43
43
  alias :etag? :etag
44
44
 
45
- def initialize(*)
46
- super
47
-
48
- @cache_control = {}
49
- @etag = self["ETag"]
50
-
51
- if cache_control = self["Cache-Control"]
52
- cache_control.split(/,\s*/).each do |segment|
53
- first, last = segment.split("=")
54
- @cache_control[first.to_sym] = last || true
55
- end
56
- end
57
- end
58
-
59
45
  def last_modified
60
46
  if last = headers['Last-Modified']
61
47
  Time.httpdate(last)
@@ -77,6 +63,18 @@ module ActionDispatch
77
63
 
78
64
  private
79
65
 
66
+ def prepare_cache_control!
67
+ @cache_control = {}
68
+ @etag = self["ETag"]
69
+
70
+ if cache_control = self["Cache-Control"]
71
+ cache_control.split(/,\s*/).each do |segment|
72
+ first, last = segment.split("=")
73
+ @cache_control[first.to_sym] = last || true
74
+ end
75
+ end
76
+ end
77
+
80
78
  def handle_conditional_get!
81
79
  if etag? || last_modified? || !@cache_control.empty?
82
80
  set_conditional_cache_control!
@@ -14,11 +14,15 @@ module ActionDispatch
14
14
  end
15
15
 
16
16
  def read(key)
17
- @store.read(key) || []
17
+ if data = @store.read(key)
18
+ Marshal.load(data)
19
+ else
20
+ []
21
+ end
18
22
  end
19
23
 
20
24
  def write(key, value)
21
- @store.write(key, value)
25
+ @store.write(key, Marshal.dump(value))
22
26
  end
23
27
 
24
28
  ::Rack::Cache::MetaStore::RAILS = self
@@ -56,26 +56,25 @@ module ActionDispatch # :nodoc:
56
56
 
57
57
  cattr_accessor(:default_charset) { "utf-8" }
58
58
 
59
- module Setup
60
- def initialize(status = 200, header = {}, body = [])
61
- self.body, self.header, self.status = body, header, status
59
+ include Rack::Response::Helpers
60
+ include ActionDispatch::Http::Cache::Response
62
61
 
63
- @sending_file = false
64
- @blank = false
62
+ def initialize(status = 200, header = {}, body = [])
63
+ self.body, self.header, self.status = body, header, status
65
64
 
66
- if content_type = self["Content-Type"]
67
- type, charset = content_type.split(/;\s*charset=/)
68
- @content_type = Mime::Type.lookup(type)
69
- @charset = charset || "UTF-8"
70
- end
65
+ @sending_file = false
66
+ @blank = false
71
67
 
72
- yield self if block_given?
68
+ if content_type = self["Content-Type"]
69
+ type, charset = content_type.split(/;\s*charset=/)
70
+ @content_type = Mime::Type.lookup(type)
71
+ @charset = charset || "UTF-8"
73
72
  end
74
- end
75
73
 
76
- include Rack::Response::Helpers
77
- include Setup
78
- include ActionDispatch::Http::Cache::Response
74
+ prepare_cache_control!
75
+
76
+ yield self if block_given?
77
+ end
79
78
 
80
79
  def status=(status)
81
80
  @status = Rack::Utils.status_code(status)
@@ -116,9 +115,32 @@ module ActionDispatch # :nodoc:
116
115
 
117
116
  EMPTY = " "
118
117
 
118
+ class BodyBuster #:nodoc:
119
+ def initialize(response)
120
+ @response = response
121
+ @body = ""
122
+ end
123
+
124
+ def bust(body)
125
+ body.call(@response, self)
126
+ body.close if body.respond_to?(:close)
127
+ @body
128
+ end
129
+
130
+ def write(string)
131
+ @body << string.to_s
132
+ end
133
+ end
134
+
119
135
  def body=(body)
120
136
  @blank = true if body == EMPTY
121
137
 
138
+ if body.respond_to?(:call)
139
+ ActiveSupport::Deprecation.warn "Setting a Proc or an object that responds to call " \
140
+ "in response_body is no longer supported", caller
141
+ body = BodyBuster.new(self).bust(body)
142
+ end
143
+
122
144
  # Explicitly check for strings. This is *wrong* theoretically
123
145
  # but if we don't check this, the performance on string bodies
124
146
  # is bad on Ruby 1.8 (because strings responds to each then).
@@ -150,6 +172,10 @@ module ActionDispatch # :nodoc:
150
172
  headers['Location'] = url
151
173
  end
152
174
 
175
+ def close
176
+ @body.close if @body.respond_to?(:close)
177
+ end
178
+
153
179
  def to_a
154
180
  assign_default_content_type_and_charset!
155
181
  handle_conditional_get!
@@ -162,7 +162,7 @@ module ActionDispatch
162
162
 
163
163
  # Returns all the \subdomains as a string, so <tt>"dev.www"</tt> would be
164
164
  # returned for "dev.www.rubyonrails.org". You can specify a different <tt>tld_length</tt>,
165
- # such as 2 to catch <tt>["www"]</tt> instead of <tt>"www.rubyonrails"</tt>
165
+ # such as 2 to catch <tt>"www"</tt> instead of <tt>"www.rubyonrails"</tt>
166
166
  # in "www.rubyonrails.co.uk".
167
167
  def subdomain(tld_length = @@tld_length)
168
168
  subdomains(tld_length).join(".")
@@ -167,8 +167,8 @@ module ActionDispatch
167
167
 
168
168
  handle_options(options)
169
169
 
170
- @set_cookies[key] = options
171
- @delete_cookies.delete(key)
170
+ @set_cookies[key.to_s] = options
171
+ @delete_cookies.delete(key.to_s)
172
172
  value
173
173
  end
174
174
 
@@ -181,7 +181,7 @@ module ActionDispatch
181
181
  handle_options(options)
182
182
 
183
183
  value = @cookies.delete(key.to_s)
184
- @delete_cookies[key] = options
184
+ @delete_cookies[key.to_s] = options
185
185
  value
186
186
  end
187
187
 
@@ -1,7 +1,7 @@
1
1
  <h1>
2
2
  <%=h @exception.class.to_s %>
3
3
  <% if @request.parameters['controller'] %>
4
- in <%=h @request.parameters['controller'].classify.pluralize %>Controller<% if @request.parameters['action'] %>#<%=h @request.parameters['action'] %><% end %>
4
+ in <%=h @request.parameters['controller'].camelize %>Controller<% if @request.parameters['action'] %>#<%=h @request.parameters['action'] %><% end %>
5
5
  <% end %>
6
6
  </h1>
7
7
  <pre><%=h @exception.message %></pre>
@@ -49,8 +49,8 @@ module ActionDispatch
49
49
  # You may wish to organize groups of controllers under a namespace. Most
50
50
  # commonly, you might group a number of administrative controllers under
51
51
  # an +admin+ namespace. You would place these controllers under the
52
- # app/controllers/admin directory, and you can group them together in your
53
- # router:
52
+ # <tt>app/controllers/admin</tt> directory, and you can group them together
53
+ # in your router:
54
54
  #
55
55
  # namespace "admin" do
56
56
  # resources :posts, :comments
@@ -152,7 +152,7 @@ module ActionDispatch
152
152
  # }
153
153
  # end
154
154
  #
155
- # Using the multiline match modifier will raise an ArgumentError.
155
+ # Using the multiline match modifier will raise an +ArgumentError+.
156
156
  # Encoding regular expression modifiers are silently ignored. The
157
157
  # match will always use the default encoding or ASCII.
158
158
  #
@@ -335,7 +335,7 @@ module ActionDispatch
335
335
  #
336
336
  # [:on]
337
337
  # Shorthand for wrapping routes in a specific RESTful context. Valid
338
- # values are :member, :collection, and :new. Only use within
338
+ # values are +:member+, +:collection+, and +:new+. Only use within
339
339
  # <tt>resource(s)</tt> block. For example:
340
340
  #
341
341
  # resource :bar do
@@ -352,7 +352,7 @@ module ActionDispatch
352
352
  #
353
353
  # [:constraints]
354
354
  # Constrains parameters with a hash of regular expressions or an
355
- # object that responds to #matches?
355
+ # object that responds to <tt>matches?</tt>
356
356
  #
357
357
  # match 'path/:id', :constraints => { :id => /[A-Z]\d{5}/ }
358
358
  #
@@ -373,7 +373,7 @@ module ActionDispatch
373
373
  # See <tt>Scoping#defaults</tt> for its scope equivalent.
374
374
  #
375
375
  # [:anchor]
376
- # Boolean to anchor a #match pattern. Default is true. When set to
376
+ # Boolean to anchor a <tt>match</tt> pattern. Default is true. When set to
377
377
  # false, the pattern matches any request prefixed with the given path.
378
378
  #
379
379
  # # Matches any request starting with 'path'
@@ -517,15 +517,15 @@ module ActionDispatch
517
517
  # You may wish to organize groups of controllers under a namespace.
518
518
  # Most commonly, you might group a number of administrative controllers
519
519
  # under an +admin+ namespace. You would place these controllers under
520
- # the app/controllers/admin directory, and you can group them together
521
- # in your router:
520
+ # the <tt>app/controllers/admin</tt> directory, and you can group them
521
+ # together in your router:
522
522
  #
523
523
  # namespace "admin" do
524
524
  # resources :posts, :comments
525
525
  # end
526
526
  #
527
527
  # This will create a number of routes for each of the posts and comments
528
- # controller. For Admin::PostsController, Rails will create:
528
+ # controller. For <tt>Admin::PostsController</tt>, Rails will create:
529
529
  #
530
530
  # GET /admin/posts
531
531
  # GET /admin/posts/new
@@ -536,7 +536,7 @@ module ActionDispatch
536
536
  # DELETE /admin/posts/1
537
537
  #
538
538
  # If you want to route /posts (without the prefix /admin) to
539
- # Admin::PostsController, you could use
539
+ # <tt>Admin::PostsController</tt>, you could use
540
540
  #
541
541
  # scope :module => "admin" do
542
542
  # resources :posts
@@ -546,7 +546,7 @@ module ActionDispatch
546
546
  #
547
547
  # resources :posts, :module => "admin"
548
548
  #
549
- # If you want to route /admin/posts to PostsController
549
+ # If you want to route /admin/posts to +PostsController+
550
550
  # (without the Admin:: module prefix), you could use
551
551
  #
552
552
  # scope "/admin" do
@@ -555,11 +555,11 @@ module ActionDispatch
555
555
  #
556
556
  # or, for a single case
557
557
  #
558
- # resources :posts, :path => "/admin"
558
+ # resources :posts, :path => "/admin/posts"
559
559
  #
560
560
  # In each of these cases, the named routes remain the same as if you did
561
561
  # not use scope. In the last case, the following paths map to
562
- # PostsController:
562
+ # +PostsController+:
563
563
  #
564
564
  # GET /admin/posts
565
565
  # GET /admin/posts/new
@@ -587,7 +587,7 @@ module ActionDispatch
587
587
  #
588
588
  # === Examples
589
589
  #
590
- # # route /posts (without the prefix /admin) to Admin::PostsController
590
+ # # route /posts (without the prefix /admin) to <tt>Admin::PostsController</tt>
591
591
  # scope :module => "admin" do
592
592
  # resources :posts
593
593
  # end
@@ -597,7 +597,7 @@ module ActionDispatch
597
597
  # resources :posts
598
598
  # end
599
599
  #
600
- # # prefix the routing helper name: sekret_posts_path instead of posts_path
600
+ # # prefix the routing helper name: +sekret_posts_path+ instead of +posts_path+
601
601
  # scope :as => "sekret" do
602
602
  # resources :posts
603
603
  # end
@@ -679,12 +679,12 @@ module ActionDispatch
679
679
  # resources :posts
680
680
  # end
681
681
  #
682
- # # maps to Sekret::PostsController rather than Admin::PostsController
682
+ # # maps to <tt>Sekret::PostsController</tt> rather than <tt>Admin::PostsController</tt>
683
683
  # namespace :admin, :module => "sekret" do
684
684
  # resources :posts
685
685
  # end
686
686
  #
687
- # # generates sekret_posts_path rather than admin_posts_path
687
+ # # generates +sekret_posts_path+ rather than +admin_posts_path+
688
688
  # namespace :admin, :as => "sekret" do
689
689
  # resources :posts
690
690
  # end
@@ -712,6 +712,7 @@ module ActionDispatch
712
712
  # constraints(:post_id => /\d+\.\d+) do
713
713
  # resources :comments
714
714
  # end
715
+ # end
715
716
  #
716
717
  # === Restricting based on IP
717
718
  #
@@ -846,20 +847,20 @@ module ActionDispatch
846
847
  # You may wish to organize groups of controllers under a namespace. Most
847
848
  # commonly, you might group a number of administrative controllers under
848
849
  # an +admin+ namespace. You would place these controllers under the
849
- # app/controllers/admin directory, and you can group them together in your
850
- # router:
850
+ # <tt>app/controllers/admin</tt> directory, and you can group them together
851
+ # in your router:
851
852
  #
852
853
  # namespace "admin" do
853
854
  # resources :posts, :comments
854
855
  # end
855
856
  #
856
- # By default the :id parameter doesn't accept dots. If you need to
857
- # use dots as part of the :id parameter add a constraint which
857
+ # By default the +:id+ parameter doesn't accept dots. If you need to
858
+ # use dots as part of the +:id+ parameter add a constraint which
858
859
  # overrides this restriction, e.g:
859
860
  #
860
861
  # resources :articles, :id => /[^\/]+/
861
862
  #
862
- # This allows any character other than a slash as part of your :id.
863
+ # This allows any character other than a slash as part of your +:id+.
863
864
  #
864
865
  module Resources
865
866
  # CANONICAL_ACTIONS holds all actions that does not need a prefix or
@@ -909,7 +910,7 @@ module ActionDispatch
909
910
 
910
911
  alias :member_name :singular
911
912
 
912
- # Checks for uncountable plurals, and appends "_index" if the plural
913
+ # Checks for uncountable plurals, and appends "_index" if the plural
913
914
  # and singular form are the same.
914
915
  def collection_name
915
916
  singular == plural ? "#{plural}_index" : plural
@@ -975,7 +976,7 @@ module ActionDispatch
975
976
  # resource :geocoder
976
977
  #
977
978
  # creates six different routes in your application, all mapping to
978
- # the GeoCoders controller (note that the controller is named after
979
+ # the +GeoCoders+ controller (note that the controller is named after
979
980
  # the plural):
980
981
  #
981
982
  # GET /geocoder/new
@@ -1024,7 +1025,7 @@ module ActionDispatch
1024
1025
  # resources :photos
1025
1026
  #
1026
1027
  # creates seven different routes in your application, all mapping to
1027
- # the Photos controller:
1028
+ # the +Photos+ controller:
1028
1029
  #
1029
1030
  # GET /photos/new
1030
1031
  # POST /photos
@@ -1082,9 +1083,13 @@ module ActionDispatch
1082
1083
  # Is the same as:
1083
1084
  #
1084
1085
  # resources :posts do
1085
- # resources :comments
1086
+ # resources :comments, :except => [:show, :edit, :update, :destroy]
1086
1087
  # end
1087
- # resources :comments
1088
+ # resources :comments, :only => [:show, :edit, :update, :destroy]
1089
+ #
1090
+ # This allows URLs for resources that otherwise would be deeply nested such
1091
+ # as a comment on a blog post like <tt>/posts/a-long-permalink/comments/1234</tt>
1092
+ # to be shortened to just <tt>/comments/1234</tt>.
1088
1093
  #
1089
1094
  # [:shallow_path]
1090
1095
  # Prefixes nested shallow routes with the specified path.
@@ -1107,11 +1112,11 @@ module ActionDispatch
1107
1112
  #
1108
1113
  # === Examples
1109
1114
  #
1110
- # # routes call Admin::PostsController
1115
+ # # routes call <tt>Admin::PostsController</tt>
1111
1116
  # resources :posts, :module => "admin"
1112
1117
  #
1113
1118
  # # resource actions are at /admin/posts.
1114
- # resources :posts, :path => "admin"
1119
+ # resources :posts, :path => "admin/posts"
1115
1120
  def resources(*resources, &block)
1116
1121
  options = resources.extract_options!
1117
1122
 
@@ -1151,7 +1156,7 @@ module ActionDispatch
1151
1156
  # end
1152
1157
  #
1153
1158
  # This will enable Rails to recognize paths such as <tt>/photos/search</tt>
1154
- # with GET, and route to the search action of PhotosController. It will also
1159
+ # with GET, and route to the search action of +PhotosController+. It will also
1155
1160
  # create the <tt>search_photos_url</tt> and <tt>search_photos_path</tt>
1156
1161
  # route helpers.
1157
1162
  def collection
@@ -1175,7 +1180,7 @@ module ActionDispatch
1175
1180
  # end
1176
1181
  #
1177
1182
  # This will recognize <tt>/photos/1/preview</tt> with GET, and route to the
1178
- # preview action of PhotosController. It will also create the
1183
+ # preview action of +PhotosController+. It will also create the
1179
1184
  # <tt>preview_photo_url</tt> and <tt>preview_photo_path</tt> helpers.
1180
1185
  def member
1181
1186
  unless resource_scope?