Search code examples
ruby-on-railsarrayshamlloopsenumerator

array separate array ruby on rails


i have the following code which is meant to be looping over an array, with a comma after each object expect the last idea

-if is_manager(team)
   - is_manager(team).map(&:fullname).each.join(',') do |name|
   = "#{name}"

it appears that the code is trying to be executed, but for some reason the .join element is causing it to error like below

undefined method `join' for #<Enumerator: ["Tom Garcia", "Paul McGuane"]:each>

what do i need to do, to have this working?


Solution

  • -if is_manager(team)
       = is_manager(team).map(&:fullname).join(',')