nebulab / simple_command

A simple, standardized way to build and use Service Objects (aka Commands) in Ruby
http://nebulab.it
MIT License
624 stars 55 forks source link

undefined method `full_messages` for SimpleCommand::Errors #17

Closed alexperto closed 4 years ago

alexperto commented 5 years ago

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 https://github.com/nebulab/simple_command/blob/ddf4f6744db3b3d81fd07c8374ddc48774492535/spec/simple_command/errors_spec.rb#L67, 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)
bguban commented 5 years ago

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 https://github.com/nebulab/simple_command/pull/19. I hope it will be merged and we can use all features from ActiveModel module.

bguban commented 5 years ago

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 https://github.com/nebulab/simple_command/issues/22 to force the release :)