Obfuscated URLS for hobo models

21 views
Skip to first unread message

mkar...@gmail.com

unread,
Aug 8, 2012, 2:28:29 PM8/8/12
to hobo...@googlegroups.com
I'm currently making a prototype app in hobo.
Part of the spec is that certain objects have
three access states, private, unlisted and public.

Unlisted objects should have a long, random url
to prevent accidental or systematic discovery.

Doing this in standard rails is fairly straightforward,
but I confess that I'm a bit stuck about how to
approach this with Hobo.

Any pointers will be most welcome.

Mike

Bryan Larsen

unread,
Aug 8, 2012, 3:15:36 PM8/8/12
to hobo...@googlegroups.com
I'm not sure how you would have done it in plain Rails, because I
would do it in roughly the same way: redefine to_param on your model
to return something that looks random

The only difference with Rails is that you may also want to define
"find_instance" on your controller that does the find given the param.
If you do that you can use the default hobo controller methods
unchanged.

Bryan
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/CRW6cjMR5uYJ.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.

mkar...@gmail.com

unread,
Aug 9, 2012, 3:45:28 AM8/9/12
to hobo...@googlegroups.com
Ah. It was the 'find_instance' that I needed.

Thank you.

Mike
Reply all
Reply to author
Forward
0 new messages