3

I'm looking at creating a dashboard for a logged in user which would then query the display other models data.

Would the best way to do this be to use something similar to this post: Map URL "/users/id" to "/dashboard" in Rails 3?, then to use a custom dashboard controller or would something like the Cells gem make this more straight forward?

I've also read this post which talks about something similar: How to pass argument to delegate method in Rails

Many thanks,

James

Community
  • 1
  • 1
James
  • 357
  • 1
  • 4
  • 13
  • Kind of depends what you want to do. If it makes sense for the /users/1 show action to be the dashboard, then you could simply use that action, and add another url for /dashboard. However, if you want more than just links to other controllers & actions, such as customizing the dashboard, i suggest making a dashboard controller. – agmcleod Nov 15 '11 at 17:21
  • Good point. It might be worth creating a seperate controller otherwise things could get messy. Could I just use a standard controller used with the generate command? – James Nov 15 '11 at 18:43
  • Yes, that's a good place to start. You can always add a model later if you need to store settings or something. – agmcleod Nov 16 '11 at 04:10

1 Answers1

2

I've decided to use the Cells gem (http://cells.rubyforge.org/) along with a dashboard controller. Something similar is discussed here: http://lostechies.com/derickbailey/2011/04/11/cells-partial-controllers-and-views-for-rails-3/

Some of these views will need to be used across several pages so this solution should keep things neat and maintainable.

James
  • 357
  • 1
  • 4
  • 13
  • Almost 3 years later , i am still facing the same issue . Any light on how to go on doing it ? . Rails version used is 3.2.8 – Caffeine Coder May 01 '14 at 13:08