changeset 466:a7dc708d48a1 feature_36

Created the one-to-one relationship between bibliography authors and users.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 22 Jun 2011 13:10:59 +0100
parents 5123e3a1c9cb
children c1ecc16cf38e
files vendor/plugins/redmine_bibliography/app/models/author.rb vendor/plugins/redmine_bibliography/init.rb vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb
diffstat 3 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/models/author.rb	Tue Jun 21 18:11:41 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/models/author.rb	Wed Jun 22 13:10:59 2011 +0100
@@ -2,6 +2,6 @@
   has_many :authorships
   has_many :publications, :through => :authorships
 
-  # belongs_to :user
+  belongs_to :user
   
 end
--- a/vendor/plugins/redmine_bibliography/init.rb	Tue Jun 21 18:11:41 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/init.rb	Wed Jun 22 13:10:59 2011 +0100
@@ -6,10 +6,16 @@
 # Patches to the Redmine core.
 Dispatcher.to_prepare :redmine_model_dependencies do
   require_dependency 'project'
+  require_dependency 'user'
 
   unless Project.included_modules.include? Bibliography::ProjectPublicationsPatch
     Project.send(:include, Bibliography::ProjectPublicationsPatch)
   end
+
+  unless Project.included_modules.include? Bibliography::UserAuthorPatch
+    Project.send(:include, Bibliography::UserAuthorPatch)
+  end
+
 end
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb	Wed Jun 22 13:10:59 2011 +0100
@@ -0,0 +1,11 @@
+require_dependency 'user'
+
+module Bibliography
+  module UserAuthorPatch
+    def self.included(base)
+          base.class_eval do
+            has_one :publication
+          end
+    end #self.included
+  end #UserPublicationsPatch
+end #RedmineBibliography
\ No newline at end of file