Trying to create an array or has of ids and names but
@campaign_ids_and_names = Hash.new
@campaign_ids.each do |cid|
@campaign_ids_and_names.merge!(cid => Campaign.find(cid, :user => current_user).name)
end
@campaign_ids_and_names
keeps just returning 1
I know the ID’s do exist in the Campaign table.
I think the issue is more my knowledge of how to create 1 array or hash from another.
Any help greatly appreciated.
Try something like this instead:
You should also checkout Active Record associations : http://guides.rubyonrails.org/association_basics.html
Which will help you clean up what you’re trying to do even more into something like: