diff options
author | Gaston Ramos <ramos.gaston@gmail.com> | 2010-09-13 17:14:37 -0300 |
---|---|---|
committer | Gaston Ramos <ramos.gaston@gmail.com> | 2010-09-27 15:25:23 -0300 |
commit | 30fb3638cce6fd27d003c7e0c4f689a0f1e28177 (patch) | |
tree | d43dfd3dd8c84f241234ba568bb49d74196166ea /activeresource/lib/active_resource | |
parent | a71e07d61e8bb69788b7120a5cf0d3620c6094be (diff) | |
download | rails-30fb3638cce6fd27d003c7e0c4f689a0f1e28177.tar.gz rails-30fb3638cce6fd27d003c7e0c4f689a0f1e28177.tar.bz2 rails-30fb3638cce6fd27d003c7e0c4f689a0f1e28177.zip |
- refactoring, move prefix_options check to a custom method
Diffstat (limited to 'activeresource/lib/active_resource')
-rw-r--r-- | activeresource/lib/active_resource/base.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index 80af7e7adf..911ae37b35 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -621,11 +621,7 @@ module ActiveResource # # => /posts/5/comments/1.xml?active=1 # def element_path(id, prefix_options = {}, query_options = nil) - - p_options = HashWithIndifferentAccess.new(prefix_options) - prefix_parameters.each do |p| - raise MissingPrefixParam if p_options[p].blank? - end + check_prefix_options(prefix_options) prefix_options, query_options = split_options(prefix_options) if query_options.nil? "#{prefix(prefix_options)}#{collection_name}/#{URI.escape id.to_s}.#{format.extension}#{query_string(query_options)}" @@ -848,6 +844,14 @@ module ActiveResource end private + + def check_prefix_options(prefix_options) + p_options = HashWithIndifferentAccess.new(prefix_options) + prefix_parameters.each do |p| + raise(MissingPrefixParam, "#{p} prefix_option is missing") if p_options[p].blank? + end + end + # Find every resource def find_every(options) begin |