So I’m running into a weird issue that I’m sure is something simple that I’m missing. For the life of me, however, I can’t figure it out.
I have a ‘collection’ that I use for equipment on the game I’m coding. It’s setup like this:
collection :lotor_equipment, “AresMUSH::LotorEquipment”
And it’s defined like this:
class LotorEquipment < Ohm::Model
include ObjectModel
attribute :name
attribute :model
attribute :type
attribute :scale
attribute :skill
attribute :ammo
attribute :cost
attribute :availability
attribute :fire_rate
attribute :difficulty
attribute :range
attribute :damage
attribute :notes
reference :character, "AresMUSH::Character"
index :name
end
When I try to execute LotorEquipment.create(name: self.equipment_name, character: model) in the code I get the following error:
2020-12-01 19:13:41 ERROR - Error in equipment/add lightsaber: client=16 error=undefined method
indices' for nil:NilClass backtrace=["/home/ares/.rvm/gems/ruby-2.6.3/gems/ohm-3.1.1/lib/ohm.rb:1336:in
save’", “/home/ares/aresmush/engine/aresmush/models/ohm_callbacks.rb:42:insave'", "/home/ares/.rvm/gems/ruby-2.6.3/gems/ohm-3.1.1/lib/ohm.rb:1094:in
create’”, “/home/ares/aresmush/plugins/lotor/commands/add_equipment.rb:50:inblock in handle'", "/home/ares/aresmush/engine/aresmush/helpers/class_target_finder.rb:25:in
with_a_character’”, “/home/ares/aresmush/plugins/lotor/commands/add_equipment.rb:41:inhandle'", "/home/ares/aresmush/engine/aresmush/plugin/command_handler.rb:25:in
on_command’”, “/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:98:inblock (3 levels) in on_command'", "/home/ares/aresmush/engine/aresmush/error_block.rb:6:in
with_error_handling’”, “/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:93:in `block (2 levels) in on_command’”]
Everything seems to be working fine. When I take the LotorEquipment.create out everything seems fine. It seems to be pulling the equipment fields properly, getting the model, etc, and so on. I’ve used some variation on the code I’m using here lots of times and this is the first time I’ve gotten this error. It’s perplexing.
Thanks in advance for any insight!