So I am trying to parse a list of emails separated by a comma and inputted in a form using the built-in CSV library in rails 3.
Here is the code:
@variable = params[:body]
@csv = CSV.parse(@variable, :col_sep => ",")
@csv.each do |row|
user = User.where(:email => row)
However, the output is something like this:
- - [email protected]
- ! ' [email protected]'
Therefore, each row in the @csv that I am trying to go over is an entire list of emails. How can I separate them? Thanks!