Automatic update with has_and_belongs_to_many (:through)

Hi,

I have an application with a relation (many to many) via a :through. I
want this to be automatically updated just like with a regular
many_to_many. Just like I read here:
http://wiki.rubyonrails.com/rails/pages/CheckboxHABTM

Is this possible? I just can’t get it to work…

Here are my models:

class Declaration < ActiveRecord::Base
#Foreign key is niet nodig, maar wordt wel aangeraden
belongs_to :owner, :class_name => ‘User’, :foreign_key => ‘user_id’
has_many :declarations_payers
has_many :users, :through => :declarations_payers

validates_presence_of :user_id
validates_numericality_of :user_id
validates_presence_of :amount
validates_numericality_of :amount
validates_presence_of :description

validates_associated :owner
validates_associated :users

end

class DeclarationsPayer < ActiveRecord::Base
belongs_to :user
belongs_to :declaration

validates_presence_of :declaration_id
validates_numericality_of :declaration_id
validates_presence_of :user_id
validates_numericality_of :declaration_id

validates_associated :user
validates_associated :declaration
end

class User < ActiveRecord::Base
has_many :deposits
has_many :declarations_users
has_many :declarations, :through => :declarations_users
has_many :my_declarations, :class_name => ‘Declarations’, :through
=> :declarations_users

def fullname
return self.firstname + ’ ’ + self.lastname
end

end

Is it possible to add a new controller and automatically add the
appropriate users in the declarations_payers table?
Is was trying to do something like this:
<%= check_box_tag ‘declaration[declarations_payer.user]’, user.id %>

But it just didn’t work…

Look here for my previous question about this application:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6fe2827af57a4123

Thanks in advance!