Closed xpe closed 9 years ago
see https://github.com/for-GET/machine/blob/1bcee13974513ec1b79c6fdd1ecbbde332543361/src/FSMResource/create.coffee#L11 and https://github.com/for-GET/machine/blob/1bcee13974513ec1b79c6fdd1ecbbde332543361/src/Resource.coffee#L230
path
is in charge with
1) (if the current resource doesn't have an id already) getting an id, for instance, from an external system, 2) constructing the URL for that resource 3) returning that URL
If path
doesn't come out empty handed, then create_path
succeeds.
With some setups (e.g. message queues and alikes), that can obviously be impossible, but then path
's implementation can be that it returns true
or some temporary http://example.com/item/tmp0
path which is resolved by the web server alone (when the real path cannot be constructed and known now)
PS: I don't know if you noticed the difference between the suffices of different callbacks :in
means internal, but still overloadable, while other suffices denote the output type and those should be implemented (i.e. there is no default implementation)
I don't understand the context or purpose of it. Thanks in advance for helping me understand.
P.S. I presume that
create
is where the actual resource creation would/should happen. Sincecreate_path
happens immediately before, I though that would be enough of a clue to figure it out, but I'm still unsure.