Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails automatically downcase on create

class Transaction < ActiveRecord::Base
   validates :name, presence: true
   validates :amount, presence: true, numericality: true
   before_save :downcase_fields

   def downcase_fields
      self.name.downcase!
   end
end
 
PREVIOUS NEXT
Tagged: #rails #automatically #downcase #create
ADD COMMENT
Topic
Name
6+1 =