discourse/discourse — pull request #1847 by nickborromeo (2014-01-21 02:22:13+00:00)
Title: Change user update to use #fetch for defaults

This changes the use of the || operator when setting the default of the
user attribute if the key does not exist to #fetch. This will make sure
that if false is passed in as the value it will still fail and use the
default setting.

This also adds constants to define and array and a hash of symbols which
is iterated over to set the users attributes.

The motivation for this refactor was the code climate score. I would like to extract setting of the attributes into methods like set_category_ids or set_user_values to make the methods smaller and easier to maintain. I would appreciate any feedback on how you would want to go about it or if it is even possible.