changeset 608:c7559c3a8d03 feature_36

Fixed a bug when a validation error occurs: keeps the project_id so that the publication is still saved in the same circumstances.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 18 Aug 2011 22:27:19 +0100
parents bdaabf6ee591
children 3221b2ab7804
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
diffstat 1 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Thu Aug 18 17:44:12 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Thu Aug 18 22:27:19 2011 +0100
@@ -16,20 +16,14 @@
     @publication.build_bibtex_entry
     
     # and at least one author
-    # @publication.authorships.build.build_author
-    
-    @project_id = params[:project_id]
-    @current_user = User.current    
-    
+    # @publication.authorships.build.build_author        
     @author_options = Authorship.like_unique(User.name).find(:all, :limit => 100)
   end
 
   def create    
-    find_project_by_project_id
-    
+    @project_id = params[:project_id]    
     @author_options = Authorship.like_unique(User.name).find(:all, :limit => 100)
-    
-    
+        
     @publication = Publication.new(params[:publication])
         
     # @project = Project.find(params[:project_id])
@@ -39,7 +33,7 @@
       flash[:notice] = "Successfully created publication."
       redirect_to :action => :show, :id => @publication, :project_id => @project.id
     else
-      render :action => 'new'
+      render :action => 'new', :project_id => @project_id
     end
   end