[Rails] after_save, after_create,
before_save etc... multiple times launching ...bug???
hangonsoft at free.fr
hangonsoft at free.fr
Wed Jan 26 17:05:55 GMT 2005
i forget one thing...i'm running on ruby 1.8.2, webrick , mysql 4.1.9 and macosx
Selon hangonsoft at free.fr:
>
> hi,
>
> i have 2 tables (rooms & exams) linked by a intermediate table (has and
> belongs
> to many relation)
>
>
> when an new exam is created i want it to be validated for every room
>
> so inside exam model file i wrote:
>
> before_create :linkeveryroom
>
> private
> def linkeveryroom
> self.rooms<<Room.find_all
> end
>
> (or something like that i'm not in front of my Mac)
>
> it seems to work BUT the association is done 3 to 6 times (depends on what i
> use
> after-save or after_create or even with before)...each linking is present
> multiple times in the intermediate table (exams_rooms)
>
> someone experiencing the same behaviours???
>
>
> hangon
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
More information about the Rails
mailing list