Created
October 3, 2009 20:51
-
-
Save harley/200858 to your computer and use it in GitHub Desktop.
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
# All is good, just a tiny suggestion: | |
# app/controllers/dashboard_controller.rb: line 18 | |
# Instead of: | |
@watched_objects = current_user.user_config.watched_data_objects.split(", ").map{|id| DataObject.find(id)}.flatten.group_by(&:data_type) | |
# Taking of .find syntax accepting list if id's, consider finding them all at once (please test it first) | |
# also .flatten is not needed) | |
DataObject.find(current_user.user_config.watched_data_objects.split(", ")).group_by(&:data_tytpe) | |
# also, it's normally OK to separate out to two lines so it's clearer to read | |
data_object_ids = current_user.user_config.watched_data_objects.split(", ") | |
@watched_objects = DataObject.find(data_object_ids).group_by(&:data_type) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment