jeudi 2 juillet 2015

Rails create callback for 2 dependent resources

I want to know how i can use create callback like before_create or after_create for the two dependent models.

class User < ActiveRecord::Base

end

class Member < ActiveRecord::Base

end

Lets suppose i have two models called User and Member and i want to create a member whenever any user will be created and want to create user whenever any member will be created .

If i will use the after_create or before_create callback in both the models it will run as never ending loop .so how this can be done.

Aucun commentaire:

Enregistrer un commentaire