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/a400fc59-7991-49d7-a67c-5b84dd59352an%40googlegroups.com.
