Sha256: 1a31c9efaeda0bd568bb3186723b479832d880d4ee54dad88b28a3d03137e70a
Contents?: true
Size: 466 Bytes
Versions: 2
Compression:
Stored size: 466 Bytes
Contents
class SpudCalendar < ActiveRecord::Base has_many :spud_calendar_events, :dependent => :destroy validates_presence_of :title, :color validates :identifier, :presence => true, :uniqueness => true before_validation :set_identifier scope :with_identifier, ->(identifier){ where(:identifier => identifier).first } private def set_identifier if identifier.nil? && title.present? self.identifier = title.parameterize.underscore end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tb_events-1.1.2 | app/models/spud_calendar.rb |
tb_events-1.1.1 | app/models/spud_calendar.rb |