How do I create Twitter style URLs for my app - Using existing application or app redesign - Ruby on
Posted
by bgadoci
on Stack Overflow
See other posts from Stack Overflow
or by bgadoci
Published on 2010-04-30T04:59:19Z
Indexed on
2010/04/30
8:37 UTC
Read the original article
Hit count: 405
I have developed a blog application of sorts that I am trying to allow other users to take advantage of (for free and mostly for family). I wondering if the authentication I have set up will allow for such a thing. Here is the scenario.
Currently the application allows for users to sign up for an account and when they do so they can create blog posts and organize those posts via tags. The application displays no data publicly (another words, you have to login to see anything). To gain access you have to create an account and even after you do, you cannot see anyone else's information as the applications filters using the current_user method and displays in the /posts/index.html.erb page. This would be great if a user only wanted to blog and share it with themselves, not really what I am looking for.
My question has two parts (hopefully I won't make anyone mad by not putting these into two questions)
- Is it possible for a particular users data to live at www.myapplication.com/user without moving everything to the /user/show.html.erb file?
- Is it possible to make some of that information (living at the URL) public but still require login for create and destroy actions.
Essentially, exactly like twitter. I am just curious if I can get from where I am (using the current_user methods across controllers to display in /posts/index.html.erb) to where I want to be. My fear is that I have to redesign the app such that the user data lives in the /user/show.html.erb page.
Thoughts?
UPDATE: I am using Clearance for authentication by Thoughtbot. I wonder if there is something I can set in the vendored gem path to represent the /posts/index.html.erb code as the /user/id code and replace id with the user name.
© Stack Overflow or respective owner