With super you can call a method on the parent class with the same name in the child class, for example:
class Foo def my_method 'Hello there' end end class Bar < Foo def my_method super end end b = Bar.new b.my_method # => Hello there
Ruby search a method #my_method in the ancestor chain, if the method not exist it will show an error NoMethodError
`my_method': super: no superclass method `my_method' for #<Bar:0x0000564740b32170> (NoMethodError)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
With super you can call a method on the parent class with the same name in the child class, for example:
Ruby search a method #my_method in the ancestor chain, if the method not exist it will show an error NoMethodError