I'm not sure if this is just a lacking of the Rails language, or if I am searching all the wrong things here on Stack Overflow, but I cannot find out how to add an attribute to each record in an array.
Here is an example of what I'm trying to do:
@news_stories.each do |individual_news_story|
@user_for_record = User.where(:id => individual_news_story[:user_id]).pluck('name', 'profile_image_url');
individual_news_story.attributes(:author_name) = @user_for_record[0][0]
individual_news_story.attributes(:author_avatar) = @user_for_record[0][1]
end
Any ideas?