If the form doesn't pass validation, the tokens are lost and have to be entered again. What would be a clean way to have it keep the tokens on validation errors.
I don't like the way I'm doing it now:
ruby
defcreate@book = Book.new(params[:book])
params[:author_tokens].split(',').each do |author|
@book.authors << Author.find(author)
end
...
end
Never mine. I was doing it wrong. It works fine.
If the form doesn't pass validation, the tokens are lost and have to be entered again. What would be a clean way to have it keep the tokens on validation errors.
I don't like the way I'm doing it now: