This repository was archived by the owner on Apr 22, 2025. It is now read-only.
V1.0.0.rc1
Pre-release
Pre-release
[1.0.0] - (in beta)
Breaking changes
- Ruby < 3.2 support dropped. The minimum supported Ruby version is now 3.2.0
#encoded_idnow defaults to returning an 'annotated' ID, one in which a prefix is added to the encoded ID to indicate
the 'type' of the record the ID represents. This can be disabled. IDs generated by older versions of this gem will
decode correctly. But not that IDs generated by this version onwards will not decode correctly by older versions of this
gem so make sure to disable annotation if you need to support older versions of this gem.#name_for_encoded_id_slugno longer provides a default implementation, it is up to the user to define this method,
or configure the gem to use a different method name.#slugged_encoded_idno longer takes awith:parameter. To specify the name of the method to call to generate the
slug, use theslug_value_method_nameconfiguration option.
Added
- New
EncodedId::Rails::Persistsmodule which adds hooks to the model to persist the encoded ID to the DB (see docs). #encoded_id_hashhas been added to return only the encoded ID without an annotation prefix. If annotation is disabled,
this method is basically an alias to#encoded_id..find_all_by_encoded_idhas been added to return all records matching the given encoded ID. This will return all
matching records whose IDs are encoded in the encoded_id. Missing records are ignored..find_all_by_encoded_id!like.find_all_by_encoded_idbut raises anActiveRecord::RecordNotFoundexception if
any of the records are not found.Configuration#model_to_param_returns_encoded_idto allowEncodedId::Rails::Modelinclusion to also bring in
EncodedId::Rails::PathParamautomatically.
Fixed
#decode_encoded_idnow raises if the encoded ID is not a string.- Handle more cases where a record held onto a memoized
encoded_ideven though itsidhad changed