Created
April 25, 2009 15:56
-
-
Save house9/101669 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
# this worked as expected on mysql | |
# on postgresql it created a new widget with id of 0 | |
def some_method | |
widget = Widget.find_or_initialize_by_id(params[:widget_id]) | |
# ... | |
end | |
# workaround code for postgresql | |
def some_method | |
widget = Widget.find_or_initialize_by_id(params[:widget_id]) | |
widget = Widget.new if widget.id == 0 | |
# ... | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment