Question: I'm trying to insert some bulk of Data to a Particular Column in my Table by using *CSV* file format. My code is as follows:

**Code**:

```
def maritalstatus_migration
   filename = "#{RAILS_ROOT}/config/MaritalStatus_Data_Migration_240114.csv"
   file=File.new(filename,"r")
   while (line = file.gets)
      columns = line.split("$")
      employee = Employee.find_by_employeeid(columns[0].to_s.chomp.strip)
      personnel = Personnel.find_by_extid(columns[0].to_s.chomp.strip)
      if employee && personnel
         sheet_marital_status = columns[1].to_s.chomp.strip
         if sheet_marital_status == 'Married' or 'MARRIED'
            personnel.marital_status = 'Married'
         elsif sheet_marital_status == 'Unmarried' or 'UNMARRIED'
            personnel.marital_status = 'Unmarried'
         elsif sheet.marital_status ='Unknown' or 'UNKNOWN'
            personnel.marital_status = 'Unknown'
         else
            personnel.marital_status = columns[1].to_s.chomp.strip
         end
      end
   end
end     

```

When I run my method in Console,I get a Warning saying:

```
String literal in condition

```

pointing to the line `personnel.marital_status = columns[1].to_s.chomp.strip`, what am i doing wrong.Any Suggestions will be greatly appreciated.

Answer: 
A correction to the code especially where you are using OR condition should mute the Warning

```
if ['Married','MARRIED'].include?(sheet_marital_status)
personnel.marital_status = 'Married'
elsif ['Unmarried','UNMARRIED'].include?(sheet_marital_status)
personnel.marital_status = 'Unmarried'
elsif ['Unknown','UNKNOWN'].include?(sheet_marital_status)
personnel.marital_status = 'Unknown'
else
personnel.marital_status = columns[1].to_s.chomp.strip
end

```

Because if you use `'XXX' or 'xxx'`, it always evaluates to 'XXX'. Which means you are comparing sheet\_marital\_status with only the first string. And that's probably what the compiler warning is indicating. You better use Include. 

lemme know your findings too.
I'd use a `case` statement:

```
personnel.marital_status = case columns[1].to_s.chomp.strip
                           when 'Married', 'MARRIED'
                             'Married'
                           when 'Unmarried', 'UNMARRIED'
                             'Unmarried'
                           when 'Unknown', 'UNKNOWN'
                             'Unknown'
                           else
                             columns[1].to_s.chomp.strip
                           end

```