Created
September 18, 2018 19:04
-
-
Save jc00ke/968f32d021fe4da07401acec36b93585 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bar | |
:bar | |
end | |
def foo(a, b=bar) | |
puts [a, b].inspect | |
end | |
foo("hi") | |
# => ["hi", :bar] | |
foo("hi", "this is my bar") | |
# => ["hi", "this is my bar"] | |
def foo(a, b=bar()) # do the parens help? | |
puts [a, b].inspect | |
end | |
foo("hi") | |
# => ["hi", :bar] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Turns out, the 2nd arg is never passed in code or tests anyway, so I'm going with
bar
is actually aActiveRecord::FinderMethods.find_by!
and we can't continue of the model doesn't exist anyway.