I've been going around a bit for a while now, I don't understand why ruby ??doesn't recognize the constant, here is my code if you can help me.
app.rb
require 'bundler'
Bundler.require
require_relative 'lib/user'
require_relative 'lib/event'
binding.pry
and when I type that in my code to declare my event
meeting = WorkEvent.new("2019-01-17 09:00", 70, "réunion de travail", [julie, jean])
who is supposed to activate this part
class Event
attr_accessor :start_date, :duration, :title, :attendees
@@attendees = Array.new
def initialize(start_date_register, duration_register, title_register, attendees_register)
@start_date = Time.parse(start_date_register)
@duration = duration_register.to_i
@title = title_register
@attendees = attendees_register
end
class WorkEvent < Event
def is_event_acceptable?
if @attendees.length > 3 || @duration > 60
puts "Cette réunion ne respecte pas nos bonnes pratiques !"
return false
else
puts "Cette réunion est OK."
return true
end
end
end
and the terminal returns me
[6] pry(main)> meeting = WorkEvent.new("2019-01-17 09:00", 70, "réunion de travail", [julie, jean])
NameError: uninitialized constant WorkEvent
from (pry):6:in `<main>'
question from:
https://stackoverflow.com/questions/65911979/constant-class-inheritance-not-recognized-ruby 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…