mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Replace map+compact with select
This commit is contained in:
parent
2a9a10f5e3
commit
cbf924ef08
1 changed files with 1 additions and 1 deletions
|
@ -76,7 +76,7 @@ module ActiveModel
|
|||
attribute_names -= Array.wrap(except).map(&:to_s)
|
||||
end
|
||||
|
||||
method_names = Array.wrap(options[:methods]).map { |n| n if respond_to?(n.to_s) }.compact
|
||||
method_names = Array.wrap(options[:methods]).select { |n| respond_to?(n) }
|
||||
Hash[(attribute_names + method_names).map { |n| [n, send(n)] }]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue