Class: Spina::Admin::Conferences::Institution

Inherits:
ApplicationRecord show all
Defined in:
app/models/spina/admin/conferences/institution.rb

Overview

Institution records.

Validators

Presence

#name, #city.

Translations

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cityString?

Returns the city of the institution.

Returns:

  • (String, nil)

    the city of the institution



21
# File 'app/models/spina/admin/conferences/institution.rb', line 21

translates :name, :city, fallbacks: true

#delegatesActiveRecord::Relation

Note:

This relation accepts nested attributes.

Note:

An institution cannot be destroyed if it has dependent delegates.

Returns directly associated delegates.

Returns:

  • (ActiveRecord::Relation)

    directly associated delegates

See Also:



39
# File 'app/models/spina/admin/conferences/institution.rb', line 39

has_many :delegates, inverse_of: :institution, dependent: :restrict_with_error

#logoSpina::Image?

Returns directly associated image.

Returns:

  • (Spina::Image, nil)

    directly associated image



28
# File 'app/models/spina/admin/conferences/institution.rb', line 28

belongs_to :logo, class_name: 'Spina::Image', optional: true

#nameString?

Returns the name of the institution.

Returns:

  • (String, nil)

    the name of the institution



21
# File 'app/models/spina/admin/conferences/institution.rb', line 21

translates :name, :city, fallbacks: true

#roomsActiveRecord::Relation

Note:

An institution cannot be destroyed if it has dependent rooms.

Returns directly associated rooms.

Returns:

  • (ActiveRecord::Relation)

    directly associated rooms

See Also:



33
# File 'app/models/spina/admin/conferences/institution.rb', line 33

has_many :rooms, -> { includes(:translations) }, inverse_of: :institution, dependent: :restrict_with_error

Instance Method Details

#sortedActiveRecord::Relation

Returns all institutions, ordered by name.

Returns:

  • (ActiveRecord::Relation)

    all institutions, ordered by name



24
# File 'app/models/spina/admin/conferences/institution.rb', line 24

scope :sorted, -> { i18n.order :name }