ual_app/app/models/topic.rb
2014-08-24 00:18:02 +02:00

26 lines
446 B
Ruby

# -*- encoding : utf-8 -*-
class Topic < ActiveRecord::Base
belongs_to :admin
#attr_accessible :description, :title
validates :title, :presence => true
has_many :notes
has_many :topic_student_groups
has_many :student_groups, :through => :topic_student_groups
has_one :block, :as => :blockable
def alloweds_types
self.block.allow_types :all
end
before_create do
self.block = Block.new
end
end