Sha256: 61d0aa71ea0efbc3f6849ace507ba09206e3c0e2f54628759d8b51af3baaae84

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

# Students process
class StudentsProcess
  def create_student(sObjectType, hParams)
      PrcLib::state ("Running creation process for object '%s' = '%s'" % [sObjectType, hParams[:student_name] ])

      oObject = controller_create(sObjectType)
      raise "Student '%s' not created." % hParams[:student_name] if oObject.nil?
      PrcLib::info ("'%s': '%s' created with id %s" % [sObjectType, hParams[:student_name],  oObject[:id]])
      oObject
  end

end

# Declaring your data model and handlers.
class Lorj::BaseDefinition

   # We need to define the student object and the handler to use while we need to create it.
   define_obj(:student,
   {
      :create_e => :create_student,   # The function to call in the class Students
      :query_e  => :controller_query, # We use predefined call to the controller query
      :get_e    => :controller_get,   # We use predefined call to the controller get
      :delete_e => :controller_delete # We use predefined call to the controller delete
   })

   obj_needs    :data,         :student_name,        { :for => [:create_e], :mapping => :name }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lorj-0.2.0 example/students_2/process/Students.rb
lorj-0.1.0 example/students_2/process/Students.rb