ねえ、私はRuby on Railsの初心者です。このブログから簡単なプログラムを実行しようとしていますが、多くの問題エラーに直面しています。 http: //goodbadtech.com/2009/05/13/Ruby-on-Rails-import-csv-data-into-database/ 解決策を理解できませんでした。
これがエラーログです。
/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!'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/application/routes_reloader.rb:7:in `block in initialize'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `call'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/application/finisher.rb:63:in `block (2 levels) in <module:Finisher>'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/application/finisher.rb:64:in `call'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/application/finisher.rb:64:in `block in <module:Finisher>'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/initializable.rb:30:in `instance_exec'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/initializable.rb:30:in `run'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/initializable.rb:55:in `block in run_initializers'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/initializable.rb:54:in `each'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/initializable.rb:54:in `run_initializers'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/application.rb:96:in `initialize!'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/railtie/configurable.rb:30:in `method_missing'
from /home/jeevan/csv/config/environment.rb:5:in `<top (required)>'
from /home/jeevan/csv/config.ru:4:in `require'
from /home/jeevan/csv/config.ru:4:in `block in <main>'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:51:in `instance_eval'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:51:in `initialize'
from /home/jeevan/csv/config.ru:1:in `new'
from /home/jeevan/csv/config.ru:1:in `<main>'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:40:in `eval'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:40:in `parse_file'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/server.rb:200:in `app'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/commands/server.rb:46:in `app'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/server.rb:301:in `wrapped_app'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/server.rb:252:in `start'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/commands/server.rb:70:in `start'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/commands.rb:54:in `block in <top (required)>'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/commands.rb:49:in `tap'
from /home/jeevan/.rvm/gems/Ruby-1.9.2-p290/gems/railties-3.1.1/lib/Rails/commands.rb:49:in `<top (required)>'
from script/Rails:6:in `require'
from script/Rails:6:in `<main>'
これで私を助けてください
これは、構文エラーがあり、「プログラムを完了することがこれ以上期待されていないときにend
キーワードが見つかりました」という意味になります。これは通常、「オープナー」の数が不均衡であることが原因です。例えば、
foo.rb:( デモンストレーション )
if true
puts "hello world"
end # the indent
end # is a lie
4行目:構文エラー、予期しないkEND [keyword_end]、$ endが必要です
ハッピーコーディング。
これは通常、構文エラーですが、RVM gemsetのgemに不明な問題があるため、まったく同じエラーメッセージが表示されます。構文エラーが表示されない場合は、gemsetを削除して再作成してみてください。
同様のエラーが発生しました。編集者が引用符を変更したことが原因であることがわかりました"
Macエディタで「スマートに」。
また、routes.rbからコンマを省略することで、余分なend
を使用せずにこれを取得しました。