Skip to content

Instantly share code, notes, and snippets.

@eserna27
Created October 19, 2018 18:47
Show Gist options
  • Save eserna27/2f7c4192c2939541fa998b5554d3940f to your computer and use it in GitHub Desktop.
Save eserna27/2f7c4192c2939541fa998b5554d3940f to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
has_many registereds, class_name: "Client"
end
class Client < ActiveRecord::Base
belongs_to registered_by, class_name: "User", foreign_key: "registrator_id"
end
schema.rb
client
registrator_id #user_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment