Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8750653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:54:17+00:00 2026-06-13T12:54:17+00:00

The following code: require ‘csv’ desc Import Voters from CSV File task :import =>

  • 0

The following code:

require 'csv'

desc "Import Voters from CSV File"
task :import => [:environment] do

  file ="db/GOTV.csv"

  CSV.foreach(file, :headers => true) do |row|
    Voter.create({
      :last_name => row[0], 
      :first_name => row[1],
      :middle_name => row[2],
      :name_suffix => row[3],
      :primary_address => row[4],
      :primary_city => row[5],
      :primary_state => row[6],
      :primary_zip => row[7],
      :primary_zip4 => row[8],
      :primary_unit => row[9],
      :primary_unit_number => row[10],
      :phone_number => row[11],
      :phone_code => row[12],
      :gender => row[13],
      :party_code => row[14],
      :voter_score => row[15],
      :congressional_district => row[16],
      :house_district => row[17],
      :senate_district => row[18],
      :county_name => row[19],
      :voter_key => row[20],
      :household_id => row[21],
      :client_id => row[22],
      :state_voter_id => row[23]
    })
  end

…is throwing the following error:

/Users/ecumbee/Desktop/cloudvoters/lib/tasks/import.rake:35: syntax error, unexpected $end, expecting kEND
  end
     ^

I’ve tried removing the end, which throws the same error I’ve tried adding another end but it results in a can not compile error.

Edit:
error when adding a second end statement

Don't know how to build task 'db:import'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:54:18+00:00Added an answer on June 13, 2026 at 12:54 pm

    In the error message, $end refers to the end of the input file, while kEND refers to the end keyword, so it’s complaining about a missing end, not an extra one.

    If you still get a syntax error after adding another end, that’s something unrelated to this error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code require 'test_helper' class ApplicationControllerTest < ActionController::TestCase test should display
The following code returns an error and I dont know why: require rexml/document include
The following code does not time out in Ruby 1.9.3p194 (2012-04-20) [i386-mingw32]: require 'timeout'
the following code raises the aforementioned error, how can I fix that? require 'mechanize'
I have the following node.js server-side code: var app = require('http').createServer(handler) , io =
The following code: (require '[clojure.set]) (println (clojure.set/difference '(a b c d) '(c d e
Consider the following code: require(Hmisc) num.boots <- 10 data <- rchisq(500, df = 5)
I am using following code and want to know whether we require to set
Sometimes I have seen following code. gem 'factory_girl','= 1.2.3' require 'factory_girl' I tried to
I have the following rspec code: require 'spec_helper' require 'mocha' require 'rr' describe ProjectsController,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.