nebulab / simple_command

A simple, standardized way to build and use Service Objects (aka Commands) in Ruby

Home Page:http://nebulab.it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undefined method `full_messages` for SimpleCommand::Errors

alexperto opened this issue · comments

I'm not sure if this is a real issue but I'm getting an error trying to use this method.
According to the spec here

expect(errors.full_messages).to eq ["Attr1 has an error", "Attr2 has an error", "Attr2 has two errors"]
, I'm doing:

irb(main):012:0> errors = SimpleCommand::Errors.new
=> {}
irb(main):013:0> errors.add(:foo, 'wha')
=> nil
irb(main):014:0> errors
=> {:foo=>["wha"]}
irb(main):015:0> errors.full_messages
Traceback (most recent call last):
        1: from (irb):15
NoMethodError (undefined method `full_messages' for {:foo=>["wha"]}:SimpleCommand::Errors)

Hi @alexperto, as I can see in the source code of the project, full_messages functionality is implemented but wasn't released to RubyGems. So you can point directly to GitHub in your Gemfile.
I created a PR to be able to use ActiveModel::Validations with this gem #19. I hope it will be merged and we can use all features from ActiveModel module.

Hi @alexperto, my merge request which adds ActiveModel::Validations was merged into master, so now you can use all of its power. But unfortunately, the gem still wasn't released onto https://rubygems.org/gems/simple_command/ . So thumb up on #22 to force the release :)