Created
June 24, 2013 05:58
-
-
Save skamithi/5848000 to your computer and use it in GitHub Desktop.
create a ruby function with defaults
This file contains hidden or 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
# Default value for :user_id is generated in this function | |
def create_project(options = {}) | |
options.reverse_merge!( | |
:user_id => @user.id | |
) | |
FactoryGirl.create(:new_project, options) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment