Class: Course::Registration

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming, ActiveModel::Translation
Includes:
ActiveModel::Conversion, ActiveModel::Model
Defined in:
app/models/course/registration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Registration


34
35
36
37
# File 'app/models/course/registration.rb', line 34

def initialize(params = {})
  @errors = ActiveModel::Errors.new(self)
  update(params)
end

Instance Attribute Details

#codeString

The registration code specified by the user.


21
22
23
# File 'app/models/course/registration.rb', line 21

def code
  @code
end

#courseCourse

The course the registration is for.


11
12
13
# File 'app/models/course/registration.rb', line 11

def course
  @course
end

#course_usernil, CourseUser

The course user created from the registration object.


27
28
29
# File 'app/models/course/registration.rb', line 27

def course_user
  @course_user
end

#errorsObject (readonly)

Returns the value of attribute errors


32
33
34
# File 'app/models/course/registration.rb', line 32

def errors
  @errors
end

#userUser

The user registering for the course.


16
17
18
# File 'app/models/course/registration.rb', line 16

def user
  @user
end

Instance Method Details

#persisted?Boolean


45
46
47
# File 'app/models/course/registration.rb', line 45

def persisted?
  false
end

#update(params) ⇒ Object


39
40
41
42
43
# File 'app/models/course/registration.rb', line 39

def update(params)
  params.each do |key, value|
    send("#{key}=", value)
  end
end