What is the use of super in Ruby Rails?

Answer

The function super is used to invoke the original method, searching of the method body starts in the super class of the object that was found to contain the original method. The following example depicts the same.

def url=(address)
super (address.blank? || address.starts_with?('http')) ? address : http://#{address}
end

All ruby Questions

Ask your interview questions on ruby

Write Your comment or Questions if you want the answers on ruby from ruby Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---