Mercurial > hg > soundsoftware-site
view vendor/plugins/redmine_bibliography/app/models/authorship.rb @ 534:cdec3eeaef7e feature_36
changes in the Query to retreive list of My Publications
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Tue, 26 Jul 2011 14:35:11 +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