view vendor/plugins/redmine_bibliography/app/models/publication.rb @ 424:b601a9e472f3 feature_36

Fixed minor bugs with the publications controller Started creating tests and fixtures.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 25 May 2011 17:46:49 +0100
parents 9595ab4cac6b
children 9cfd7a1d848e
line wrap: on
line source
# vendor/plugins/redmine_bibliography/app/models/publication.rb

class Publication < ActiveRecord::Base
  has_many :authorships
  has_many :authors, :through => :authorships
  has_one :bibtex_entry

  validates_presence_of :title
  
  attr_writer :current_step

  def current_step
    @current_step || steps.first
  end
  
  def steps
    %w[new review]
  end
  
  def next_step
    self.current_step = steps[steps.index(current_step)+1]
  end

  def previous_step
    self.current_step = steps[steps.index(current_step)-1]
  end
  
  def first_step?
    current_step == steps.first
  end

end