There is some magic in the tokenInput code i don't understand. It's closely related to one of the problems I'm having at the moment.
ruby
defauthor_tokens=(tokens)
self.author_ids = Author.ids_from_tokens(tokens)
end
seems to create the association between book and authors.
Now the problem. What if I have more attributes on the book_author join table I wish to set before saving the association?
How can I go about this, I'm pretty lost at the moment as I've tried several ways but none works nicely and looks like the Rails way to do it.
PLEASE HELP - any hint would be greately appreciated!
Great episode as always. One small question thought: What's the best way to handle validation? (Especially if you create multiple new records using jquery tokeninput)
There is some magic in the tokenInput code i don't understand. It's closely related to one of the problems I'm having at the moment.
seems to create the association between book and authors.
Now the problem. What if I have more attributes on the book_author join table I wish to set before saving the association?
How can I go about this, I'm pretty lost at the moment as I've tried several ways but none works nicely and looks like the Rails way to do it.
PLEASE HELP - any hint would be greately appreciated!
Great episode as always. One small question thought: What's the best way to handle validation? (Especially if you create multiple new records using jquery tokeninput)