Permalink
Browse files

Add #[] to Choices::Rails

* Delegates to @choices mashie first
  and then tries to execute method on self
  • Loading branch information...
1 parent ab5c534 commit 675faa587554c08b0f060fc240974b33fcd3d24d @saimonmoore saimonmoore committed Dec 20, 2010
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/choices/rails.rb
View
@@ -29,6 +29,10 @@ def respond_to?(method)
super or method.to_s =~ /=$/ or (method.to_s =~ /\?$/ and @choices.key?($`))
end
+ def[](key)
+ @choices[key] || super.send(key)
+ end
+
private
def method_missing(method, *args, &block)

0 comments on commit 675faa5

Please sign in to comment.