Skip to content

Instantly share code, notes, and snippets.

@sevenseacat
Forked from chintanparikh/gist:6987243
Last active December 25, 2015 13:59
Show Gist options
  • Save sevenseacat/6987331 to your computer and use it in GitHub Desktop.
Save sevenseacat/6987331 to your computer and use it in GitHub Desktop.
def create
@user = User.find(params[:user_id])
@stock = Stock.find_or_create_by_ticker(params[:ticker])
@user.stocks << @stock
respond_with @stock
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment