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 [email protected].
To post to this group, send email to [email protected].
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