westonganger / active_snapshot

Simplified snapshots and restoration for ActiveRecord models and associations with a transparent white-box implementation
MIT License
103 stars 16 forks source link

Incorrect use of `create_snapshot!` in the documentation #5

Closed pjmartorell closed 2 years ago

pjmartorell commented 2 years ago

Documentation states in Basic Usage chapter that create_snapshot! has a keyword argument identifier:

post = Post.first

# Create snapshot grouped by identifier, only :identifier argument is required, all others are optional
snapshot = post.create_snapshot!(
  identifier: "snapshot_1", # Required
  user: current_user,
  metadata: {
    foo: :bar
  },
)

But actually the contract of the method is the following: create_snapshot!(identifier, user: nil, metadata: nil). The first parameter is a simple argument (not a keyword argument).