Skip to content

Instantly share code, notes, and snippets.

@kalorz
Created September 17, 2012 18:07
Show Gist options
  • Save kalorz/3738827 to your computer and use it in GitHub Desktop.
Save kalorz/3738827 to your computer and use it in GitHub Desktop.
Typus + HABTM
class Author < ActiveRecord::Base
has_and_belongs_to_many :books
attr_accessible :name, :book_ids, as: [:default, :admin]
end
Author:
fields:
default: name, books
relationships: books
application: Application
class Book < ActiveRecord::Base
has_and_belongs_to_many :authors
attr_accessible :title, :author_ids, as: [:default, :admin]
end
Book:
fields:
default: title, authors
relationships: authors
application: Application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment