Class: Brand

Inherits:
ApplicationRecord show all
Defined in:
app/models/brand.rb

Overview

== Schema Information

Table name: brands
Database name: primary

id :bigint not null, primary key
description :text
name :string not null
tagline :string
created_at :datetime not null
updated_at :datetime not null
company_id :bigint
image_id :integer

Indexes

index_brands_on_company_id (company_id)

Foreign Keys

fk_rails_... (company_id => companies.id)
fk_rails_... (image_id => digital_assets.id)

Belongs to collapse

Has many collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Class Method Details

.warmlyyoursObject



42
43
44
# File 'app/models/brand.rb', line 42

def self.warmlyyours
  find_by_name('WarmlyYours')
end

Instance Method Details

#companyCompany

Returns:

See Also:



27
# File 'app/models/brand.rb', line 27

belongs_to :company

#imageImage

Returns:

See Also:



26
# File 'app/models/brand.rb', line 26

belongs_to :image, optional: true

#itemsActiveRecord::Relation<Item>

Returns:

  • (ActiveRecord::Relation<Item>)

See Also:



28
# File 'app/models/brand.rb', line 28

has_many :items, dependent: :nullify

#schema_dot_org_structureObject



32
33
34
35
36
37
38
39
40
# File 'app/models/brand.rb', line 32

def schema_dot_org_structure
  SchemaDotOrg::Brand.new(
    name: name,
    slogan: tagline,
    logo: image.image_url
    #As of 12-4-22 google doesn't seem to like a rating in here
    #aggregateRating: company.schema_dot_org_aggregate_rating
  )
end