Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use flat_map rather than map(&:...).flatten #28930

Merged
merged 1 commit into from
May 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/reflection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def klass_join_scope(table, predicate_builder) # :nodoc:
end

def constraints
chain.map(&:scopes).flatten
chain.flat_map(&:scopes)
end

def counter_cache_column
Expand Down
4 changes: 2 additions & 2 deletions activesupport/lib/active_support/i18n_railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def self.initialize_i18n(app)
case setting
when :railties_load_path
reloadable_paths = value
app.config.i18n.load_path.unshift(*value.map(&:existent).flatten)
app.config.i18n.load_path.unshift(*value.flat_map(&:existent))
when :load_path
I18n.load_path += value
else
Expand All @@ -58,7 +58,7 @@ def self.initialize_i18n(app)
directories = watched_dirs_with_extensions(reloadable_paths)
reloader = app.config.file_watcher.new(I18n.load_path.dup, directories) do
I18n.load_path.keep_if { |p| File.exist?(p) }
I18n.load_path |= reloadable_paths.map(&:existent).flatten
I18n.load_path |= reloadable_paths.flat_map(&:existent)

I18n.reload!
end
Expand Down