Hi Nathan,
I can't think of a nice and clean way of doing this. What do you think
about something like this?
def to_param
if state == 'active'
....
else
....
end
end
Then you could make sure the routing controller handle all actions
correctly.
Warm regards,
Ignacio
El 25-09-2015 a las 15:56, Nathan Peters escribió:
> I have a Project model with a number of lifecycle states. Currently in
> my app, URLs use the standard form of "#{id}-#{name}". Which is fine in
> most cases, however there is a certain state ("active") in which I am
> trying to hide the id and name so that they cannot be inferred from the
> URL. Really I am trying to hide a Project in "active" so that the links
> don't give a pointer to the Project as it exists in other states.
>
>
> I think I could add a "slug" entry to Project and populate with some
> unique random string. Then make a custom "def to_param" to use the slug
> instead of the regular URL format (and also index the slug column to
> speed lookups). However this would be used in all lifecycle states and
> would kind of defeat my purpose which is to make Project URLs in the
> "active"state unique from other states (and also hide id and name).
>
>
> I've looked into lifecycle keys but it looks like those are just
> appended to the regular URL (id and name) so don't really address my need.
>
>
> Is there an elegant, Hobo-style, way to handle this?
>
>
> Thanks,
>
> Nathan
>
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.