I am following a rails tutorial and in my class User < ActiveRecord::Base I am writing the following code to make the email address down case:
before_save { |user| user.email = email.downcase }
But what are the significance of this |user| in ruby? Previously I have seen it inside a ruby loop. I am not getting a proper keyword for search.
Thankyou.
This is a block.
useris a block parameter.before_saveis a method that takes a block, saves it and calls later, passing current instance of User as parameter.