GitHub User: telvueengineering
I think I see what he's saying. Completely remove the polymorphic association, User and MemberProfile have a simple has_one/belongs_to association, guests are stored in Users table as well, but they have no MemberProfile so the profile_id foreign key in Users is null for guests and we conditionally build a PORO for guests when a null profile_id is found.
Yes, sorry I meant GuestProfile as a PORO, not MemberProfile, as Ryan states at around 13:40 in the railscast.
It sounds like he's suggesting there would be no AR association between GuestProfile and User, that there would be a null check on profile_id in the users table and if the value was null then the app would generate a PORO in memory to handle Guest related behaviors (validations, methods, etc). But how would that PORO be bound to the relevant User record?
Curious what the MemberProfile model would look like if it were a PORO and not inheriting from AR as suggested. It could not make use of AR associations in the model, so what would that look like? Thanks for a great episode!