Sha256: 3e4dadb327b26fc7fcfb63d69135b551984884866aac9abbe93cc98c44d71e44
Contents?: true
Size: 529 Bytes
Versions: 9
Compression:
Stored size: 529 Bytes
Contents
module Disclaimer class Segment < ActiveRecord::Base attr_accessible :body, :title, :name before_save :underscore_name has_many :segment_holders has_many :documents, :through => :segment_holders validates :name, :presence => true def to_param name end def title ((!super || super.empty?) && name.present?) ? name.humanize : super end private def underscore_name self.name = self.name.downcase.gsub(/\s+/, '_') end end end
Version data entries
9 entries across 9 versions & 1 rubygems