Last active
December 13, 2016 09:05
-
-
Save alekseyl/d0e7c70c968c4436ba81abb67c59d3a3 to your computer and use it in GitHub Desktop.
for medium article 'Rails fast collection render'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nil means current_user is empty i.e. it's a guest | |
keys = [ [:user, :admin, :moderator, nil], [:ru, :en ] ] | |
# all combination of keys: | |
all_flatten_keys = keys.pop.product(*keys) | |
# [[:ru, :user], [:ru, :admin], [:ru, :moderator], [:ru, nil], | |
# [:en, :user], [:en, :admin], [:en, :moderator], [:en, nil]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment