Sha256: f57c81d43a0387c1bebe7a9424f08d59e4fc0780bcb7c48f8e7defea3058cf39
Contents?: true
Size: 793 Bytes
Versions: 1
Compression:
Stored size: 793 Bytes
Contents
class SpudInquiryForm < ActiveRecord::Base has_many :spud_inquiries, :dependent => :nullify has_many :spud_inquiry_form_fields,:dependent => :destroy,:order => "field_order ASC" accepts_nested_attributes_for :spud_inquiry_form_fields, :reject_if => lambda { |a| a[:name].blank? }, :allow_destroy => true validates :name,:presence => true,:uniqueness => true validates :url_name,:presence => true, :uniqueness => true before_validation :generate_url_name attr_accessible :name,:url_name,:recipients,:content,:subject,:spud_inquiry_form_fields_attributes, :created_at, :updated_at, :thank_you_content, :submit_title def generate_url_name if !self.name.blank? self.url_name = self.name.gsub(/[^a-zA-Z0-9\ ]/," ").gsub(/\ \ +/," ").gsub(/\ /,"-").downcase end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spud_inquiries-0.9.5 | app/models/spud_inquiry_form.rb |