Polymorphic Relationships in ActiveRecord - dick.codes

I was recently implementing a feature to support billing multi-user accounts when I realized my initial approach was missing something. It became clear as I progressed that I made a mistake in assuming the work I was doing on creating multi-user accounts would also apply for a feature planned for later in the year which would allow users to collaborate with other users in groups.My initial direction was flawed because I conflated two separate domain entities when planning: groups and accounts. Although similar in that they would represent aggregators of User records, they were different in their purpose within the domain model. An Account represents a record containing billing information for one or more users which connects to the subscription billing vendor. In contrast, a Group represents an organizational unit tying together individual users working together in some capacity to perform tasks within the application.
Polymorphic Relationships in ActiveRecord - dick.codes #ruby #rubydeveloper #rubyonrails #activerecord https://rubyonrails.ba/single/polymorphic-relationships-in-activerecord-dick-codes

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles