On Sun, Aug 29, 2021 at 8:48 PM Rob Galanakis wrote:
> For now I went with something like this (my actual implementation isn't
> quite so general):
>
> ```
> module Bulk
> class Ref
> attr_accessor :instance
> def initialize(instance)
> @instance = instance
> end
> end
> c
For now I went with something like this (my actual implementation isn't
quite so general):
```
module Bulk
class Ref
attr_accessor :instance
def initialize(instance)
@instance = instance
end
end
class Creator
def initialize(model_cls)
@model_cls = model_cls
On Sun, Aug 29, 2021 at 7:51 PM Rob Galanakis wrote:
> I am trying to optimize some code to use bulk creation of models- on the
> order of dozens, not hundreds, and I do still need models, so raw dataset
> methods aren't suitable.
>
> I don't see a way to do this with Sequel- we have Dataset#impo
I am trying to optimize some code to use bulk creation of models- on the
order of dozens, not hundreds, and I do still need models, so raw dataset
methods aren't suitable.
I don't see a way to do this with Sequel- we have Dataset#import and
#multi_insert, and they can return an array of primary
Thank you
On Sunday, August 29, 2021 at 11:24:57 AM UTC-4 Jeremy Evans wrote:
> On Sat, Aug 28, 2021 at 8:22 PM bee...@gmail.com wrote:
>
>> OK, understood. How do I insist on required parameters, named or
>> otherwise?
>>
>
> Probably easiest to check for values after calling super:
>
> def
On Sat, Aug 28, 2021 at 8:22 PM bee...@gmail.com wrote:
> OK, understood. How do I insist on required parameters, named or
> otherwise?
>
Probably easiest to check for values after calling super:
def initialize(values={})
super
raise ArgumentError unless some_criteria
# ...
end
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, bee...@gmail.com
escreveu:
> Sorry...half way through a Saturday evening. I will try with a single
> hash thrown, but how do I require such a structu