Yeah, the implementation is super simple because you are basically skipping 
a method. I think though if you are already going to have a plugin, you may 
as well give a little functionality to actually make it useful.

It seems likely someone would want this general functionality on bulk 
inserts, and opt-in specifically when that happens. This plugin was created 
and designed for instances like those, but because of the rigid 
implementation, can't really use it selectively.

Wouldn't take much to throw in an instance accessor.

I can PR it if you want, but if you think it shouldn't belong with this 
plugin, I'll just do it locally...

Aryk

On Wednesday, July 26, 2017 at 8:35:36 PM UTC-7, Jeremy Evans wrote:
>
> On Wednesday, July 26, 2017 at 8:00:29 PM UTC-7, Aryk Grosz wrote:
>>
>> Just curious, I'm wondering if it makes sense to add a flag only when you 
>> creating a lot of records at once and don't need the refresh?
>>
>> so like 
>>
>> Model.plugin :skip_create_refresh, default: false
>> record = Model.new
>> record.skip_create_refresh = true
>> record.save
>>
>> Otherwise if they don't specify default: false, then it's just the normal 
>> behavior always.
>>
>
> If you want something like that, you should probably copy the 
> skip_create_refresh plugin, and modify it to support your needs, and keep 
> it as a local plugin.
>
> Alternatively, you could just require the plugin, then extend the instance:
>
>   require 'sequel/plugins/skip_create_refresh'
>   record.extend Sequel::Plugins::SkipCreateRefresh::InstanceMethods
>
> If you look at the plugin, you'll see the implementation is super simple, 
> you could actually just do:
>
>   record.define_singleton_method(:_save_refresh){}
>
> 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 sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to