Example for has_and_belongs_to_many: Database schema (PostgreSQL) CREATE TABLE users ( id serial PRIMARY KEY, nick character varying NOT NULL, name character varying, "password" character varying NOT NULL, modified timestamp with time zone DEFAULT now() NOT NULL, created timestamp with time zone DEFAULT now() NOT NULL, "access" timestamp with time zone ); CREATE TABLE roles ( id serial PRIMARY K