Exception: ObjectifiedSessions::Errors::NoSuchFieldError

Inherits:
Base
  • Object
show all
Defined in:
lib/objectified_sessions/errors.rb

Overview

Raised when you try to read or write a field (via hash-indexing) that simply isn’t defined on your objectified session.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session_class, field_name) ⇒ NoSuchFieldError

Returns a new instance of NoSuchFieldError.



16
17
18
19
20
21
# File 'lib/objectified_sessions/errors.rb', line 16

def initialize(session_class, field_name)
  @session_class = session_class
  @field_name = field_name

  super("Class #{@session_class.name} has no field named #{@field_name.inspect}; its fields are: #{accessible_field_names.inspect}")
end

Instance Attribute Details

#field_nameObject (readonly)

Returns the value of attribute field_name.



14
15
16
# File 'lib/objectified_sessions/errors.rb', line 14

def field_name
  @field_name
end

#session_classObject (readonly)

Returns the value of attribute session_class.



14
15
16
# File 'lib/objectified_sessions/errors.rb', line 14

def session_class
  @session_class
end

Instance Method Details

#accessible_field_namesObject



23
24
25
# File 'lib/objectified_sessions/errors.rb', line 23

def accessible_field_names
  session_class.accessible_field_names
end