Skip to content

Instantly share code, notes, and snippets.

@rharriso
Created September 15, 2012 04:27
Show Gist options
  • Save rharriso/3726345 to your computer and use it in GitHub Desktop.
Save rharriso/3726345 to your computer and use it in GitHub Desktop.
add authors to books, has and belongs to many bro
def add_authors
#set authors to those in the form
unless params[:authors].blank?
@book.authors.clear
@book.authors << Author.find(params[:authors])
@book.save
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment