https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Despr�s <nicolas.despres(a)gmail.com>
Clean the session initialization.
* web/ranch/test/functional/graph_form_controller_test.rb,
* web/ranch/test/functional/projects_controller_test.rb,
* web/ranch/app/controllers/ranch_controller.rb: No longer session
initialization since it's automaticaly done by the layout.
* web/ranch/app/views/layouts/_left_margin.rhtml: Init the session
variable if it is not.
app/controllers/ranch_controller.rb | 9 ---------
app/views/layouts/_left_margin.rhtml | 13 +++++++++++++
test/functional/graph_form_controller_test.rb | 10 ----------
test/functional/projects_controller_test.rb | 10 ----------
4 files changed, 13 insertions(+), 29 deletions(-)
Index: web/ranch/test/functional/graph_form_controller_test.rb
--- web/ranch/test/functional/graph_form_controller_test.rb (revision 25)
+++ web/ranch/test/functional/graph_form_controller_test.rb (working copy)
@@ -11,16 +11,6 @@
@controller = GraphFormController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
-
- @request.session[:projects] = Project.find_by_sql "SELECT id, name " +
- "FROM projects " +
- "WHERE 1 " +
- "ORDER BY name"
- @request.session[:benches] = Bench.find_by_sql "SELECT id, name, project_id
" +
- "FROM benches " +
- "WHERE 1 " +
- "GROUP BY name " +
- "ORDER BY project_id, name"
end
def test_index
Index: web/ranch/test/functional/projects_controller_test.rb
--- web/ranch/test/functional/projects_controller_test.rb (revision 25)
+++ web/ranch/test/functional/projects_controller_test.rb (working copy)
@@ -11,16 +11,6 @@
@controller = ProjectsController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
-
- @request.session[:projects] = Project.find_by_sql "SELECT id, name " +
- "FROM projects " +
- "WHERE 1 " +
- "ORDER BY name"
- @request.session[:benches] = Bench.find_by_sql "SELECT id, name, project_id
" +
- "FROM benches " +
- "WHERE 1 " +
- "GROUP BY name " +
- "ORDER BY project_id, name"
end
def test_show
Index: web/ranch/app/controllers/ranch_controller.rb
--- web/ranch/app/controllers/ranch_controller.rb (revision 25)
+++ web/ranch/app/controllers/ranch_controller.rb (working copy)
@@ -3,15 +3,6 @@
layout 'ranch_benches_list'
def index
- session[:projects] = Project.find_by_sql "SELECT id, name " +
- "FROM projects " +
- "WHERE 1 " +
- "ORDER BY name"
- session[:benches] = Bench.find_by_sql "SELECT id, name, project_id " +
- "FROM benches " +
- "WHERE 1 " +
- "GROUP BY name " +
- "ORDER BY project_id, name"
end
end
Index: web/ranch/app/views/layouts/_left_margin.rhtml
--- web/ranch/app/views/layouts/_left_margin.rhtml (revision 25)
+++ web/ranch/app/views/layouts/_left_margin.rhtml (working copy)
@@ -1,4 +1,17 @@
<!-- -*- html -*- -->
+<%
+ if session[:projects].nil? or session[:benches].nil?
+ session[:projects] = Project.find_by_sql "SELECT id, name " +
+ "FROM projects " +
+ "WHERE 1 " +
+ "ORDER BY name"
+ session[:benches] = Bench.find_by_sql "SELECT id, name, project_id " +
+ "FROM benches " +
+ "WHERE 1 " +
+ "GROUP BY name " +
+ "ORDER BY project_id, name"
+ end
+%>
<table>
<% for project in session[:projects] %>
<tr>