Multiplos semestres

This commit is contained in:
2008-08-03 10:55:44 -03:00
parent 0695c44b21
commit d235466463
15 changed files with 100 additions and 31 deletions

View File

@@ -43,8 +43,11 @@ class Course < ActiveRecord::Base
# Validacao
generate_validations
validates_uniqueness_of :short_name
validates_format_of :short_name, :with => /^[^0-9]/
def related_courses
Course.find(:all, :conditions => [ 'short_name = ?', self.short_name], :limit => 4, :order => 'period desc')
end
def after_create
App.inital_wiki_pages.each do |page_title|
@@ -54,6 +57,7 @@ class Course < ActiveRecord::Base
end
def to_param
self.short_name
return self.short_name if self.period == App.current_period
return self.id
end
end

View File

@@ -22,7 +22,7 @@ class User < ActiveRecord::Base
acts_as_paranoid
# Associacoes
has_and_belongs_to_many :courses, :order => 'full_name'
has_and_belongs_to_many :courses, :order => 'full_name', :conditions => "period = #{App.current_period}"
# Validacao
validates_length_of :login, :within => 3..40