In ruby on rails guide, there is a section 5.3 Using a Proc with :if and :unless discussed about Using a Proc with :if and :unless in validation helper. It gives the following example:
class Account < ActiveRecord::Base
  validates_confirmation_of :password,
    :unless => Proc.new { |a| a.password.blank? }
end
Does this 'a' in Proc refers to the current Account instance? Can I understand it(the 'a') as the reference of the current Account instance?
is t开发者_如何学Che :password and a.password point at the same thing?
That is precisely what it is. a refers to the object being validated.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论