Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Daniel Kummer's Profile

GitHub User: danielkummer

Site: http://www.code-n-fold.com

Comments by Daniel Kummer

Avatar

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
def author_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!

Avatar

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)