docbrown/app/models/listing_endorsement.rb
Raphael Noriode 30b3592488
[deploy] Listing endorsements: models setup (#9841)
* create listing endorsement model and write test to validate it

* create the classified_listing_endorsements table

* create model associations with seed data and test validations

* modify test and create more seed date for endorsement

* modify the model naming, changed seed data to become radomized and updated the test file

* remove unnecessary function
2020-08-20 11:13:44 +02:00

10 lines
335 B
Ruby

class ListingEndorsement < ApplicationRecord
self.table_name = "classified_listing_endorsements"
belongs_to :listing, foreign_key: :classified_listing_id, inverse_of: :endorsements
belongs_to :user
validates :user_id, presence: true
validates :classified_listing_id, presence: true
validates :content, presence: true
end