Christian Fazzini
Christian Fazzini

Reputation: 19723

Routing setup for a user account page

I see this quite a bit with online apps. Lets take, for example, the following url:

https://github.com/account

For something like above, the route (in Rails 3) would look like:

get '/account', :to => 'users#edit', :as => 'account' 

Or is there a better way to do this? Perhaps create its own Accounts controller? How would you go about this?

Upvotes: 1

Views: 208

Answers (1)

Jimmy
Jimmy

Reputation: 9815

Probably instead of

get '/account', :to => 'users#edit', :as => 'account' 

it would be

et '/account', :to => 'users#show', :as => 'account' 

With an edit button if the displayed user is the logged in one (like how github does it)

But yeah to me that seems like the easiest way to accomplish such a task

Upvotes: 1

Related Questions