I'm taking apart Ben Curtis's OpenID / RESTful authentication 'head start' and trying to understand it enough to integrate it into my app.
# registration is a hash containing the valid sreg keys given above # use this to map them to fields of your user model def assign_registration_attributes!(registration) { :login => 'nickname', :email => 'email' }.each do | model_attribute, registration_attribute| unless registration[registration_attribute].blank? @user.send("#{model_attribute}=", registration[registration_attribute]) end end @user.save! end I've never seen .each used in this fashion? Why is he using the ".each" when he appears to be just operating on ONE record? What does he mean by "sreg" keys? What does he mean to "use this to map them to fields of your user model"? Could someone explain in 'human words' what is going on here? What do these variable mean/do? "model_attribute, registration_attribute" Thank you, David