Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Why not using AR standard callback propagation instead of creating version after_update/create ?  #108

@itkin

Description

@itkin

Hello,

I'm implementing your gem in one project (thx for wthe good work btw! ;-) ), and was wondering why you rely on after_create & update callback when creating a version.

  #creation.rb line 8
  after_create :create_initial_version, :if => :create_initial_version?
  after_update :create_version, :if => :create_version?
  after_update :update_version, :if => :update_version?

There is a rails standard feature for callback propagation between associated models , wouldn't it be more interesting to do something like that :

  #creation.rb line 8
  before_create :instanciate_initial_version, :if => :create_initial_version?
  before_update :instanciate_version, :if => :create_version?
  before_update :instanciate_version, :if => :update_version?

I'm perhaps missing something here, so let me know if you see any drawback to such evolution, but it would reduce the number of db commit and ensure that the after_commit include the last version instance ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions