I'm using Ryan Bates' nifty authentication in my application for user signup and login. Each user has_many :widgets
, but I'd like to allow users to browse other users' widgets. I'm thinking that a url scheme like /username/widgets/widget_id
would make a lot of sense--it would keep all widget-related code in the same place (the widgets controller). However, I'm not sure how to use this style of URL in my app.
Right now my codebase is such that it permits logged-in users to browse only their own widgets, which live at /widgets/widget_id
. What changes would I need to make to routes.rb, my models classes, and any place where links to a given widget are needed?
I've done Rails work before but am a newb when it comes to more complicated routing, etc, so I'd appreciate any feedback. Thanks for your consideration!