If you need to, you can call super in your initialize, passing the parameters the way Sequel models expect.
Em dom., 29 de ago. de 2021 às 05:24, [email protected] <[email protected]> escreveu: > Sorry...half way through a Saturday evening. I will try with a single > hash thrown, but how do I require such a structure, given I can't > manipulate the initialize? > > On Saturday, August 28, 2021 at 11:22:12 PM UTC-4 [email protected] wrote: > >> OK, understood. How do I insist on required parameters, named or >> otherwise? >> >> On Saturday, August 28, 2021 at 9:41:51 PM UTC-4 Jeremy Evans wrote: >> >>> On Sat, Aug 28, 2021 at 2:26 PM [email protected] <[email protected]> >>> wrote: >>> >>>> Not sure why this is happening. I'm getting <subject> as an error. >>>> I've tried using both directive and non-directive for @id in the initialize >>>> method, with same error. Seems the object is the same column profile. Any >>>> clue why this is happening? >>>> >>>> >>>> DL.create_table? :mobibase do >>>> primary_key :id >>>> >>>> DateTime :cdate >>>> String :label, size: 200 >>>> String :note, size: 350 >>>> >>>> String :status, size: 20, default: 'new' >>>> end >>>> >>>> class Mobibase < Sequel::Model(DL[:mobibase]) >>>> >>>> def initialize(cdate, label, note) >>>> # @id = nil >>>> @cdate = cdate >>>> @label = label >>>> @note = note >>>> @status = 'new' >>>> puts "A new instantiation" >>>> end >>>> >>> >>> Don't override #initialize for Sequel::Model subclasses. >>> Sequel::Model#initialize is expected to be called with a single hash. In >>> general, you should not override methods that Sequel::Model defines to >>> change the number or type of arguments. This is true not just for >>> Sequel::Model, but for pretty much all Ruby classes, unless you are >>> subclassing from Object or BasicObject. >>> >>> Thanks, >>> Jeremy >>> >> -- > You received this message because you are subscribed to the Google Groups > "sequel-talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sequel-talk/ccc17503-769c-48b2-8f23-0239770a6c28n%40googlegroups.com > <https://groups.google.com/d/msgid/sequel-talk/ccc17503-769c-48b2-8f23-0239770a6c28n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/CANtavQ4DbRLV%2BRtBNr_p%2Bn5mqJ%3DGKzCkJ2NOpXHUHrck1cN5cg%40mail.gmail.com.
