In the admin section of a website i am building i would like to put together a dashboard page, or ‘quick look’ type page where the most recent changes/additions/etc in several different areas can be viewed.
I was thinking the best way to do this would be to use partials and have each partial contain the markup for the data i need to display.
My question is, is this the best approach? and if so, how do i separate the logic and presentation of these partials? For instance how do i put the logic in the dashboard controller, but keep the presentation in the partial rhtml?
Partials are definitely the way to go, especially when you can pass in arbitrary data into them to make them do stuff. To answer your logic separation issue specifically, you would use:
Then, inside your partial, you’d have access to @data_from_model via the some_var variable.