Rake Syntax Error Unexpected $end Expecting Kend
Contents |
here for a quick overview of vagrant syntax error, unexpected end-of-input, expecting keyword_end the site Help Center Detailed answers to any questions you might have expecting keyword_end ruby Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company
Syntax Error, Unexpected '{', Expecting $end
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, ruby syntax checker just like you, helping each other. Join them; it only takes a minute: Sign up unexpected keyword_end, expecting $end (SyntaxError) up vote 8 down vote favorite 1 hey I am newbie to ruby on rails and I am trying run a simple program from this blog and facing lot of problems error. http://goodbadtech.com/2009/05/13/ruby-on-rails-import-csv-data-into-database/ Could not able to figure out the solution. Here is the error log. /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load': /home/jeevan/csv/config/routes.rb:64: syntax error, unexpected keyword_end, expecting $end (SyntaxError) from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `block in load' from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency' from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in' from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency' from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load' from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `block in load_paths' from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `each' from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `load_paths' from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:13:in `reload!' f
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about ruby end Stack Overflow the company Business Learn more about hiring developers or posting ads with
If Else Ruby
us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is
Undefined Method For Nil Nilclass
a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up unexpected end syntax error up vote 2 down vote favorite The following code: http://stackoverflow.com/questions/8061789/unexpected-keyword-end-expecting-end-syntaxerror 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], http://stackoverflow.com/questions/13113507/unexpected-end-syntax-error :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' ruby-on-rails ruby ruby-on-rails-3.2 share|improve this question edited Oct 28 '12 at 22:34 Nat Ritmeyer 3,70752647 asked Oct 28 '12 at 22:10 Eric Cumbee 1,55682240 add a comment| 3 Answers 3 active oldest votes up vote 2 down vote accepted 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. share|improve this answer answered Oct 28 '12 at 22:20 hammar 113k9227335 add a comment| up vote 2 down vote The end in your code is for the CSV.foreach ... do block. You're missing another end for the task ... to block. If
User List Log In Rake aborted - syntax error, unexpected $end, expecting kEND Chris Bartlett (Guest) on 2007-04-17 05:14 I can't create tables via rake db:migrate without encountering this error: rake aborted! ./db/migrate//001_create_users_table.rb:11: syntax https://www.ruby-forum.com/topic/105142 error, unexpected $end, expecting kEND The 001_create_users_table.rb file contains: class CreateUsersTable < ActiveRecord::Migration def self.up create_table "users" do |table| end def self.down end end I've recently installed RoR (as per http://hivelogic.com/narrative/articles/ruby-rails...) and have been able to verify that everything is installed. I can create tables 'manually' in MySQL databases, but rake is failing every time with the same error as above. Any help would be greatly appreciated. I'm investigating RoR with syntax error a view to building some web apps with it, but this is hardly an auspicious beginning. Report post Edit Move Delete topic Reply with quote Re: Rake aborted - syntax error, unexpected $end, expecting Mohit Sindhwani (Guest) on 2007-04-17 05:20 Chris Bartlett wrote: > class CreateUsersTable < ActiveRecord::Migration > def self.up > create_table "users" do |table| > > end > > You have a do in the line above which should syntax error, unexpected be terminated with an end. This "end" closes the "do" above, but nothing closes the "def" for the self.up method. > def self.down > end > end > Try something like: class CreateUsersTable < ActiveRecord::Migration def self.up create_table "users" do |table| #do something here like creating fields inside the table end end def self.down end end Cheers Mohit. Report post Edit Delete Reply with quote Re: Rake aborted - syntax error, unexpected $end, expecting Chris Bartlett (Guest) on 2007-04-17 22:11 Thanks for your reply - you're quite right, of course. I'll pay more attention when copying and pasting sample code next time! Mohit Sindhwani wrote: > Chris Bartlett wrote: >> class CreateUsersTable < ActiveRecord::Migration >> def self.up >> create_table "users" do |table| >> >> end >> >> > You have a do in the line above which should be terminated with an end. > This "end" closes the "do" above, but nothing closes the "def" for the > self.up method. Report post Edit Delete Reply with quote Forum List Topic List New Topic Search Register User List Log In Enable email notification | Enable multi-page view Please log in before posting. Registration is free and takes only a minute. Existing account User name or e-mail address Password Always use SSL (experimental!