RoR: Best way to create a dashboard page?

In the admin section of the website I'm creating, I would like to put together a dashboard page or a “quick view” page where you can view the most recent changes / additions / etc in several different areas.

I thought the best way to do this is to use partial parts and have a partial markup for the data I need to display.

My question is: is this a better approach? and if so, how do I separate the logic and presentation of these particulars? For example, how can I put logic in a control panel controller, but save the presentation in partial rhtml?

+3
source share
2 answers

- , , , , . , :

<%= render :partial => "name_of_partial", :locals => { :some_var => @data_from_model } %>

, , @data_from_model some_var.

+2

, (, , , ). HTML.

, , - , , Google, 40- , .

<%= render :partial => 'new_users_last7days', ;locals => { :new_user_count => @new_users.size } %>
+1

All Articles