Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Vibhor Mahajan's Profile

GitHub User: vibhor86

Comments by Vibhor Mahajan

Avatar

ActiveAdmin.register User do
form do |f|
f.inputs :email, :password, :password_confirmation
f.buttons :commit
end
end

It worked after I added this in the active admin's resource file -
/app/admin/users.rb

Avatar

The ids will now contain the custom tokens in quote.
"author_tokens" parameter will now look like 1,2,'Hello',3,'are','you'

So, you may want to modify the following

def author_tokens=(ids)
self.author_ids = ids.split(",")
end

Avatar

Vinicius Depizzol made it possible to create tokens on the fly.

https://github.com/vdepizzol/jquery-tokeninput

Just add allowCustomEntry: true in Application.js

javascript
$(function() {
  $("#book_author_tokens").tokenInput("/authors.json", {
    crossDomain: false,
    prePopulate: $("#book_author_tokens").data("pre"),
    theme: "facebook",
    allowCustomEntry: true
  });
});
Avatar

In case it helps anyone...

To make it work in Rails 2.3, I had to include jQuery before jQuery-Token javascript apart from changing the version specific helpers...