changeset 459:0f9097245756 feature_36

After creating a publication in the project scope, correctly redirects to the Show action (still in the project's scope).
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 16 Jun 2011 13:33:34 +0100
parents f2288bb384bb
children 9bdb8e3b9135
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed Jun 15 17:40:18 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Thu Jun 16 13:33:34 2011 +0100
@@ -17,7 +17,7 @@
     @project_id = params[:project_id]
     
     # the step we're at in the form
-    @publication.current_step = session[:publication_step]
+    #    @publication.current_step = session[:publication_step]
 
     @new_publications = []
     session[:publications] ||= {}
@@ -34,7 +34,7 @@
     
     if @publication.save 
       flash[:notice] = "Successfully created publication."
-      redirect_to @publication
+      redirect_to :action => :show, :id => @publication, :project_id => @project.id
     else
       render :action => 'new'
     end
@@ -187,9 +187,14 @@
   
   private
    
-  def find_projectx
-   # @project variable must be set before calling the authorize filter
-   @project = Project.find(params[:project_id])
-  end
-
+  # TODO: luisf. - only here for debugging purposes 
+  # Find project of id params[:project_id]
+   def find_project_by_project_id
+     
+     logger.error { "FIND PROJECT BY PROJECT ID" }
+     
+     @project = Project.find(params[:project_id])
+   rescue ActiveRecord::RecordNotFound
+     render_404
+   end
 end