Sha256: 15c7a712288a74d86c6ea96f35d3aebd5a6bd4000db58d133ac43f5ad7bd8888

Contents?: true

Size: 453 Bytes

Versions: 60

Compression:

Stored size: 453 Bytes

Contents

# typed: strict
class SpellBook < ApplicationRecord
  validates :name, length: { minimum: 5 }, presence: true

  # simulate when belongs_to is optional by default, but it is enforced at the DB level
  belongs_to :wizard, optional: true

  # habtm enforced at the DB level
  has_and_belongs_to_many :spells

  enum book_type: {
    unclassified: 0,
    biology: 1,
    dark_art: 999,
  }

  scope :recent, -> { where('created_at > ?', 1.month.ago) }
end

Version data entries

60 entries across 22 versions & 1 rubygems

Version Path
sorbet-rails-0.7.34 spec/support/v6.0/app/models/spell_book.rb
sorbet-rails-0.7.34 spec/support/v6.1/app/models/spell_book.rb
sorbet-rails-0.7.33 spec/support/v6.1/app/models/spell_book.rb
sorbet-rails-0.7.33 spec/support/v6.0/app/models/spell_book.rb
sorbet-rails-0.7.32 spec/support/v6.0/app/models/spell_book.rb
sorbet-rails-0.7.32 spec/support/v6.1/app/models/spell_book.rb
sorbet-rails-0.7.31 spec/support/v6.0/app/models/spell_book.rb
sorbet-rails-0.7.31 spec/support/v6.1/app/models/spell_book.rb
sorbet-rails-0.7.27 spec/support/v6.1/app/models/spell_book.rb
sorbet-rails-0.7.27 spec/support/v6.0/app/models/spell_book.rb
sorbet-rails-0.7.26 spec/support/v6.1/app/models/spell_book.rb
sorbet-rails-0.7.26 spec/support/v6.0/app/models/spell_book.rb
sorbet-rails-0.7.25 spec/support/v6.1/app/models/spell_book.rb
sorbet-rails-0.7.25 spec/support/v6.0/app/models/spell_book.rb
sorbet-rails-0.7.24 spec/support/v6.0/app/models/spell_book.rb
sorbet-rails-0.7.24 spec/support/v6.1/app/models/spell_book.rb
sorbet-rails-0.7.23 spec/support/v6.0/app/models/spell_book.rb
sorbet-rails-0.7.23 spec/support/v6.1/app/models/spell_book.rb
sorbet-rails-0.7.22 spec/support/v6.0/app/models/spell_book.rb
sorbet-rails-0.7.22 spec/support/v6.1/app/models/spell_book.rb