aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-07-31 21:57:59 +0000
committerRick Olson <technoweenie@gmail.com>2006-07-31 21:57:59 +0000
commit78e37f45c64838b120699317068cf1950277897c (patch)
tree377b4676abe388af87322c5e9c96dee73596ce77 /actionpack/lib
parentab0277f22005b9690393318ef9adf94d815c1611 (diff)
downloadrails-78e37f45c64838b120699317068cf1950277897c.tar.gz
rails-78e37f45c64838b120699317068cf1950277897c.tar.bz2
rails-78e37f45c64838b120699317068cf1950277897c.zip
Fix bug when passing multiple options to SimplyRestful, like :new => { :preview => :get, :draft => :get }. [Rick Olson, Josh Susser, Lars Pind]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4641 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/resources.rb25
1 files changed, 6 insertions, 19 deletions
diff --git a/actionpack/lib/action_controller/resources.rb b/actionpack/lib/action_controller/resources.rb
index 93016cbcc5..2b4c9217d5 100644
--- a/actionpack/lib/action_controller/resources.rb
+++ b/actionpack/lib/action_controller/resources.rb
@@ -11,7 +11,7 @@ module ActionController
@singular = options[:singular] || plural.to_s.singularize
@options = options
-
+
arrange_actions
add_default_actions
set_prefixes
@@ -56,30 +56,17 @@ module ActionController
@path_prefix = options.delete(:path_prefix)
@name_prefix = options.delete(:name_prefix)
end
-
+
def arrange_actions_by_methods(actions)
- arrayize_values(flip_keys_and_values(actions || {}))
+ (actions || {}).inject({}) do |flipped_hash, (key, value)|
+ (flipped_hash[value] ||= []) << key
+ flipped_hash
+ end
end
def add_default_action(collection, method, action)
(collection[method] ||= []).unshift(action)
end
-
- def flip_keys_and_values(hash)
- hash.inject({}) do |flipped_hash, (key, value)|
- flipped_hash[value] = key
- flipped_hash
- end
- end
-
- def arrayize_values(hash)
- hash.each do |(key, value)|
- unless value.is_a?(Array)
- hash[key] = []
- hash[key] << value
- end
- end
- end
end
def resources(*entities)