Getting rid of dr_nic_magic_models
This commit is contained in:
@@ -25,7 +25,9 @@ class Attachment < ActiveRecord::Base
|
|||||||
belongs_to :course
|
belongs_to :course
|
||||||
|
|
||||||
# Validacao
|
# Validacao
|
||||||
generate_validations
|
validates_presence_of :file_name
|
||||||
|
validates_numericality_of :size, :allow_nil => true, :only_integer => true
|
||||||
|
validates_inclusion_of :front_page, :in => [true, false], :allow_nil => false, :message => ActiveRecord::Errors.default_error_messages[:blank]
|
||||||
|
|
||||||
def self.find_front_page
|
def self.find_front_page
|
||||||
Attachment.find(:all, :conditions => [ "front_page = ?", true ])
|
Attachment.find(:all, :conditions => [ "front_page = ?", true ])
|
||||||
|
|||||||
@@ -45,7 +45,11 @@ class Course < ActiveRecord::Base
|
|||||||
:order => "last_seen desc"
|
:order => "last_seen desc"
|
||||||
|
|
||||||
# Validacao
|
# Validacao
|
||||||
generate_validations
|
validates_presence_of :short_name
|
||||||
|
validates_presence_of :full_name
|
||||||
|
validates_presence_of :code
|
||||||
|
validates_numericality_of :grade, :only_integer => true
|
||||||
|
validates_inclusion_of :hidden, :in => [true, false], :allow_nil => false
|
||||||
validates_format_of :short_name, :with => /^[^0-9]/
|
validates_format_of :short_name, :with => /^[^0-9]/
|
||||||
|
|
||||||
def related_courses
|
def related_courses
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Event < ActiveRecord::Base
|
|||||||
belongs_to :course
|
belongs_to :course
|
||||||
|
|
||||||
# Validacao
|
# Validacao
|
||||||
generate_validations
|
validates_presence_of :title
|
||||||
|
|
||||||
def Event.to_ical(courses)
|
def Event.to_ical(courses)
|
||||||
courses = [courses] unless courses.kind_of?(Array)
|
courses = [courses] unless courses.kind_of?(Array)
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ class WikiPage < ActiveRecord::Base
|
|||||||
belongs_to :user, :with_deleted => true
|
belongs_to :user, :with_deleted => true
|
||||||
|
|
||||||
# Valicacao
|
# Valicacao
|
||||||
generate_validations
|
validates_presence_of :description
|
||||||
|
validates_presence_of :title
|
||||||
|
validates_presence_of :content
|
||||||
validates_uniqueness_of :title, :scope => :course_id
|
validates_uniqueness_of :title, :scope => :course_id
|
||||||
validates_uniqueness_of :canonical_title, :scope => :course_id
|
validates_uniqueness_of :canonical_title, :scope => :course_id
|
||||||
validates_format_of :title, :with => /^[^0-9]/
|
validates_format_of :title, :with => /^[^0-9]/
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ Rails::Initializer.run do |config|
|
|||||||
noresize nowrap rel rows rowspan rules scope shape size span src start
|
noresize nowrap rel rows rowspan rules scope shape size span src start
|
||||||
style summary title type usemap valign width)
|
style summary title type usemap valign width)
|
||||||
|
|
||||||
config.gem "dr_nic_magic_models"
|
|
||||||
config.gem "bluecloth"
|
config.gem "bluecloth"
|
||||||
config.gem "haml"
|
config.gem "haml"
|
||||||
config.gem "hpricot"
|
config.gem "hpricot"
|
||||||
|
|||||||
Reference in New Issue
Block a user