The #show and #reports methods used to fetch the node in different ways. These now use common code and also include the last_report, which is always used.
Signed-off-by: Igal Koshevoy <[email protected]> --- Published to repository at http://github.com/igal/puppet-dashboard/commits/bug/next/4879-commonize_nodes_controller_resource_fetch_method app/controllers/nodes_controller.rb | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index af75e54..b7ab094 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb @@ -41,7 +41,7 @@ class NodesController < InheritedResources::Base # TODO: routing currently can't handle nested resources due to node's id # requirements def reports - @node = Node.find_by_name!(params[:id]) + @node = resource @reports = @node.reports respond_to do |format| format.html { @reports = paginate_scope(@reports); render 'reports/index' } @@ -53,7 +53,7 @@ class NodesController < InheritedResources::Base protected def resource - get_resource_ivar || set_resource_ivar(end_of_association_chain.find_by_name!(params[:id])) + get_resource_ivar || set_resource_ivar(end_of_association_chain.find_by_name!(params[:id], :include => :last_report)) end # Render the index using the +scope_name+ (e.g. :successful for Node.successful). -- 1.7.2.3 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
