Mercurial > hg > soundsoftware-site
view vendor/plugins/redmine_bibliography/app/models/authorship.rb @ 535:dd9d9c0ff0f9 feature_36
created the helpers to display correctly the My Publications Authors and Projects.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Tue, 26 Jul 2011 18:25:14 +0100 |
parents | ce1614b19759 |
children | 82a6e3756383 |
line wrap: on
line source
class Authorship < ActiveRecord::Base belongs_to :author belongs_to :publication accepts_nested_attributes_for :author accepts_nested_attributes_for :publication # setter and getter for virtual attribute :user_id def user_id end def user_id=(uid) unless uid.blank? user = User.find(uid) if user.author.nil? # TODO: should reflect the name_on_paper parameter author = Author.new :name => user.name author.save! user.author = author user.save! end self.author_id = user.author.id end end end