These are chat archives for dry-rb/chat

Nov 2016
Alfonso Perez
Nov 05 2016 03:27
Hi there!
I got introduced to these gems by a coworker and they are actually making me love my daily work with Ruby!
I have been trying to implement new functionality with Structs and Types, but I am getting a uninitialized constant Types::MyType (NameError), any ideas?
Tim Riley
Nov 05 2016 05:12
Can you show us how you defined MyType, @alfonsoperez?
Alfonso Perez
Nov 05 2016 15:01
Sure!, thanks!, I created a new file under /engines/mymodel/lib (this is a rails project), /engines/mymodel/lib/types.rb
module MyModel::Types
  include Types.module # this is in /app/types/app.rb 
  AnswerOutcome = Types::Strict::String.enum('expired', 'verified', 'unverifiable', 'flag')
and in /app/types/arr.rb ...

module Types
  include Dry::Types.module
one hint I guess is that it says Types::AnswerOutcome, where it should say MyModel::Types::AnswerOutcome
Alfonso Perez
Nov 05 2016 15:14
(I am doing MyModel::Types::AnswerOutcome in another file and that's where it's failing)
Luca Guidi
Nov 05 2016 15:34
@wafcio @solnic yay! :sparkles: :clap: