search for: privilege_id

Displaying 2 results from an estimated 2 matches for "privilege_id".

2006 Jan 15
2
new objects and new associations in same view
Hello All, I generated scaffolding for my Users table and setup my additional models with their associations. I want to be able to create a new user, and its associated groups and privileges from the same view. My relationships are as follows: users: has_and_belongs_to_many :groups has_many :privileges groups: has_and_belongs_to_many :users privileges: belongs_to :user Right
2006 Nov 09
2
help with join tables and has_and_belongs_to_many
...users end Now I have a migration script to create the join table and populate a few users with some privileges... class CreateAndInitPrivileges < ActiveRecord::Migration def self.up create_table :privileges_users do |t| t.column :user_id, :integer, :null => false t.column :privilege_id, :integer, :null =>false end admin_priv = Privilege.find_by_name(''admin'') user_priv = Privilege.find_by_name(''user'') admin_user = User.find_by_email(''admin-7Ts6kVb0ZJk@public.gmane.org'') admin_user.privileges << a...