This article is just a memo to note how the polymorphic in Rails model works.
For instance, if we have app/model/a.rb then find the description as the following:
belongs_to: M polymorphic: true
then at the same time you did not find any table M in seeing the tables in schema.rb.
Only M you have is that of concern directory. This means the model class A inherit from multiple the other model classes such as B, C.
B, C is defined as belonging to the concern M, which is stated in each model class.
For more details, please refer to the link below:
http://guides.rubyonrails.org/association_basics.html#polymorphic-associations
No comments:
Post a Comment