Skip to content

Instantly share code, notes, and snippets.

@adammiribyan
Created March 17, 2019 00:44
Show Gist options
  • Select an option

  • Save adammiribyan/5057ee5db2078554233272ebd48a28d5 to your computer and use it in GitHub Desktop.

Select an option

Save adammiribyan/5057ee5db2078554233272ebd48a28d5 to your computer and use it in GitHub Desktop.
class Person < ApplicationRecord
belongs_to :personable, polymorphic: true
end
class User < ApplicationRecord
has_one :person, as: :personable
end
@adammiribyan
Copy link
Copy Markdown
Author

  1. Why the separate models?
  2. Why do people and users have the identical IDs in the urls?
  3. What's the underlying controllers structure of /people/users/?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment