Save 36% for Black Friday! Save 36% on GoRails for Black Friday! Learn more
alangosh
Joined
Activity
Posted in Google Maps and Google Places Autocomplete API with Rails, Turbolinks, and Stimulus.js Discussion
thanks. it's sp good
In essence, this code structure enables the creation of listings that are independent of users, offering flexibility in your application's data modeling.
that's great
Yes, a listing can exist without a user in the model you've outlined, thanks to the optional: true clause within the belongs_to :user association. This clause specifically informs Rails that the user_id field in the listings table is not mandatory, allowing for listings to be created without an associated user.