2014-03-09 22:58:57 +00:00
|
|
|
class JamRuby::Event < ActiveRecord::Base
|
|
|
|
|
|
2014-03-11 18:14:05 +00:00
|
|
|
attr_accessible :slug, :title, :description, :show_sponser, :social_description, as: :admin
|
2014-03-09 22:58:57 +00:00
|
|
|
|
|
|
|
|
validates :slug, uniqueness: true, presence: true
|
2014-03-10 06:31:20 +00:00
|
|
|
validates :show_sponser, :inclusion => {:in => [true, false]}
|
2014-03-09 22:58:57 +00:00
|
|
|
|
2014-03-11 18:14:05 +00:00
|
|
|
before_validation :sanitize_active_admin
|
|
|
|
|
|
|
|
|
|
def sanitize_active_admin
|
|
|
|
|
self.social_description = nil if self.social_description == ''
|
|
|
|
|
end
|
|
|
|
|
|
2014-03-10 06:31:20 +00:00
|
|
|
has_many :event_sessions, class_name: 'JamRuby::EventSession'
|
2014-03-09 22:58:57 +00:00
|
|
|
end
|