validations: undefined method `merge' for #

So, i’m trying to use hanami-validations with Rails 5 app. I have a custom predicate and i need a custom message error for this.

This code:

predicate :unique?, message: 'error test message' do |current|
    MyModel.find_by(name: current).nil?
  end

generate this error:

/Users/eduardo/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/validations-74276a8dd4b5/lib/hanami/validations.rb:148:in `messages': undefined method `merge' for #<Dry::Validation::Messages::Namespaced:0x007f9a5f3dd5f0> (NoMethodError)

Is this a bug?

Update: The problem above occurs with inline custom predicates only. The same predicate with global custom predicate works.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (12 by maintainers)

Most upvoted comments

@jodosha No problems. Thank you for your support and keep your great work at hanami-validations. It’s awesome.