rails / globalid

Identify app models with a URI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

readme: mention to_param / GlobalID::Locator.locate as a feature

nruth opened this issue · comments

It'd be nice for the readme to say a bit about to_param and GlobalID::Locator.locate working together, as it enables this:

view: link_to x, somepath(content_gid: content.to_global_id)
controller: content = GlobalID::Locator.locate params.fetch(:content_gid)

It looks like some thought has gone into this, but it's not currently advertised as a feature.
Would a readme PR be welcome for this or is it an internals thing we shouldn't be relying on?

Global ID is very much about having a serialized reference to a model from somewhere else.

My only concern is that we should advertise using a signed global id, so malicious people can't tamper with the gid. Try a PR!