# HG changeset patch # User luisf # Date 1308744659 -3600 # Node ID a7dc708d48a183c63589afabd4d90d0c4c53f8e9 # Parent 5123e3a1c9cb52b5bfd9aba4ecc40745e61ac819 Created the one-to-one relationship between bibliography authors and users. diff -r 5123e3a1c9cb -r a7dc708d48a1 vendor/plugins/redmine_bibliography/app/models/author.rb --- 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 diff -r 5123e3a1c9cb -r a7dc708d48a1 vendor/plugins/redmine_bibliography/init.rb --- 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 diff -r 5123e3a1c9cb -r a7dc708d48a1 vendor/plugins/redmine_bibliography/lib/bibliography/user_author_patch.rb --- /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