refactor: make country and state associations optional
- Change 'belongs_to :country' association to be optional - Change 'belongs_to :state' association to be optional This refactoring allows a City record to exist without having an associated Country or State, thus increasing the flexibility of the data model for various use cases.
This commit is contained in:
parent
8fce45e1d0
commit
34342a9678
@ -1,7 +1,7 @@
|
||||
class City < ApplicationRecord
|
||||
extend FriendlyId
|
||||
friendly_id :slug_candidates, use: :slugged
|
||||
belongs_to :country
|
||||
belongs_to :country, optional: true
|
||||
belongs_to :state, optional: true
|
||||
|
||||
has_many :weather_arts, dependent: :destroy
|
||||
|
Loading…
Reference in New Issue
Block a user