app/models/schedule.rb
# Checks and sets fields value defaults.
#
# === Parameters:
# - +params_hash+ => Hash of additional parameter values for attribute defaults override.
#
Checks and sets fields value defaults.
Parameters:
+params_hash+ => Hash of additional parameter values for attribute defaults override.
Checks and sets fields value defaults . Parameters : + params_hash + = > Hash of additional parameter values for attribute defaults override .
def preset_default_values( params_hash = {} )
    unless self.patient                             
      begin
        if params_hash[:patient_id]
          self.patient_id = params_hash[:patient_id].to_i
        end
      rescue
        self.patient_id = nil
      end
    end
    unless self.date_schedule                       
      begin                   
          self.date_schedule = params_hash[:date_schedule] ? params_hash[:date_schedule] : Time.now
      rescue                                        
        self.date_schedule = Time.now
      end
    end
    self
  end
def preset_default_values ( params_hash = { } ) unless self . patient begin if params_hash [ :patient_id ] self . patient_id = params_hash [ :patient_id ] . to_i end rescue self . patient_id = nil end end unless self . date_schedule begin self . date_schedule = params_hash [ :date_schedule ] ? params_hash [ :date_schedule ] : Time . now rescue self . date_schedule = Time . now end end self end
Checks and sets fields value defaults.
Checks and sets fields value defaults .
# Set current patient only if not set # A default date schedule must be set anyhow: # Set default date for this entry:
params_hash