and its relation with relatables Note about sdg_review factory: Cannot use the constantize method on the relatable_type as long as the relatable classes will be loaded and this will throw an exception because the database is not available at factiry definition time.
6 lines
171 B
Ruby
6 lines
171 B
Ruby
class SDG::Review < ApplicationRecord
|
|
validates :relatable_id, uniqueness: { scope: [:relatable_type] }
|
|
|
|
belongs_to :relatable, polymorphic: true, optional: false
|
|
end
|