* 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
10 lines
335 B
Ruby
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
|