Exception: Granite::Form::ObjectNotFound

Inherits:
Error
  • Object
show all
Defined in:
lib/granite/form/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(object, association_name, record_id) ⇒ ObjectNotFound

Returns a new instance of ObjectNotFound.



28
29
30
31
32
33
# File 'lib/granite/form/errors.rb', line 28

def initialize(object, association_name, record_id)
  primary_name = object.respond_to?(:_primary_name) ? object._primary_name : 'id'
  message = "Couldn't find #{object.class.reflect_on_association(association_name).klass.name}" \
            "with #{primary_name} = #{record_id} for #{object.inspect}"
  super(message)
end