Class: Castkit::ActiveRecord::ModelNotDefined

Inherits:
Error
  • Object
show all
Defined in:
lib/castkit/active_record/error.rb

Overview

Raised when a Castkit::DataObject does not have an associated model defined.

This typically occurs when calling ‘from_model`, `to_model`, or `update_model!` without first declaring a model via `.model SomeModel`.

Examples:

class UserDto < Castkit::DataObject
  include Castkit::ActiveRecord
  # no model defined here
end

UserDto.new.to_model
# => raises Castkit::ActiveRecord::ModelNotDefined

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ ModelNotDefined



23
24
25
# File 'lib/castkit/active_record/error.rb', line 23

def initialize(klass)
  super("No model defined for #{klass.name}. Did you forget to call model SomeModel?")
end