Skip to content

Instantly share code, notes, and snippets.

@rharriso
Created September 15, 2012 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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