Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Ruby :: including libraries in ruby 
Ruby :: ruby abs function programming 
Ruby :: rails increment counter model 
Ruby :: ruby constructors 
Ruby :: ruby array last 
Ruby :: stripe test keys 
Ruby :: ruby array with unique values 
Ruby :: rails generate model with options 
Ruby :: httparty OpenSSL::SSL::VERIFY_NONE 
Ruby :: rails start id to 1000 
Ruby :: ruby clear set 
Ruby :: ruby nth element of array 
Ruby :: symbols used in hashes 
Ruby :: rails check test database 
Ruby :: ruby regex replace capture group 
Ruby :: last select in rails 
Ruby :: rails-react syntax error jsx not enabled 
Ruby :: ruby md5 
Ruby :: ruby decode base64 
Ruby :: how to make rails 
R :: remove null element from list r 
R :: how to select all the records above a specific datetime in r 
R :: merge multiple datatable in r 
R :: how to split a column in r 
R :: r dplyr add total row 
R :: operators R 
R :: r find nas in dataframe 
R :: comment faire un boucle sur r 
R :: r count list 
R :: insert a png in R 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =