How can I make two Ruby symbols point to the same object? -


i assigning temp password users.

now have code , works:

temp_password = random_pronouncable_password @user = user.create!(params[:user].merge(:password => temp_password, :password_confirmation => temp_password)) 

but want way able this

@user = user.create!(params[:user].merge(:password, :password_confirmation => temp_password)) 

anyone know how this?

if have two, repeat them , maybe format code make repeat obvious:

@user = user.create!(params[:user].merge(     :password              => temp_password,     :password_confirmation => temp_password )) 

anything else bunch of noise serves no useful purpose. looks @ above know what's going on barely thought , that's indicator of clean code.

you come clever using hash[] constructor or possibly hash default value waste of cleverness. cleverness in limited supply should save special occasions when needed.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -