unable to create record with has_mant :through relationship

hi all,

i have a has_many :through r'ship in my application. my tables are - users, apps(short form for applications), categorizations. i'm trying to create a user in new.rhtml where all apps are also shown in checkboxes for selection. on submit, user gets created but the join table i.e. categorizations table doesn't get updated. where am i going wrong? doesn't the join table gets updated automatically? or do i've to update it manually? if yes, how? Any help will be greatly appreciated. thanks in advance.

I beleive that you need to create the categorizations yourself something like (this is untested):

class UsersController < ApplicationController def new @user = User.new @apps = App.find(:all) end

def create @user = User.new(params[:user])

      params[:user][:app_ids].each do | app_id|            @user.categorizations << Category.new(:app_id => app_id)       end

@user.save! redirect_to(:action => "new") flash[:notice] = "Thanks for signing up!" rescue ActiveRecord::RecordInvalid render :action => 'new' end end

HTH