Search code examples
ruby-on-railshas-and-belongs-to-manycheckboxrelationshipsadmin-interface

Rails3 + Typus: display habtm relationship as checkboxes


I'm managing my admin backend with Typus

I want to add a field with a checkbox for each category.
I used this code:

Post:
  fields:
    default: name, description, user, categories
    list: name, description, user, categories
    form: name, description, user, categories
  relationships: categories

But the result is a textfield with a [] inside: how do I solve this?
Is there a native way or must I override the field template?


Solution

  • To show the the checkbox for the fields you can use the existing template of the Typus

    Post:
      fields:
       default: name, description, user, categories
       list: name, description, user, categories
       form: name, description, user, categories
       options:
         templates:
           categories: boolean
       relationships: categories`