i have 3 model society and user now Society is manage by the admin model what happens is that when the user registers, the users "id" must be save simultaneously in the society models user_id field it has to happen with in the user_controller's create action

can somebody give me a simple code to do this

many thanks

1

There are 1 best solutions below

0
On

To have your user_id assigned to the society, you should set up an association between User and Society. If has_one is the wrong association, please do some research on what type of association these need to be.

# app/models/user.rb
  after_create :socialize
  has_one :society
  def socialize
    self.society.create
  end

References