Skip to content

Commit

Permalink
Add #[] to Choices::Rails
Browse files Browse the repository at this point in the history
* Delegates to @Choices mashie first
  and then tries to execute method on self
  • Loading branch information
Saimon Moore committed Dec 20, 2010
1 parent ab5c534 commit 675faa5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/choices/rails.rb
Expand Up @@ -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)
Expand Down

0 comments on commit 675faa5

Please sign in to comment.