Skip to content

Instantly share code, notes, and snippets.

@Matho
Matho / jquery-tokens-custom-tokens
Last active December 18, 2015 17:50 — forked from henkm/gist:952240
Jquery Tokens - custom tokens on the fly
Use this fork https://github.com/kusmierz/jquery-tokeninput/
See this discussion about idea http://railscasts.com/episodes/258-token-fields?view=comments#comment_152978
#model (idea 100% stolen from ryanb)
def author_tokens=(ids)
ids.gsub!(/CREATE_(.+?)_END/) do
Author.create!(:name => $1).id
end
self.author_ids = ids.split(",")