我在RoR上有点太新,无法找出错误的位置。一直关注railstutorial.org,我在推送到heroku时得到了这个。
因此而中止 - > NoMethodError:未定义的方法`link_to'for。
?? 这是我唯一能够为自己找到的东西。
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Fetching repository, done.
Counting objects: 88, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (56/56), done.
Writing objects: 100% (62/62), 23.47 KiB | 0 bytes/s, done.
Total 62 (delta 25), reused 0 (delta 0)
-----> Removing .DS_Store files
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.5.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Using rake (10.2.2)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.9.2)
Using atomic (1.1.16)
Using tzinfo (0.3.39)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using mime-types (1.25.1)
Using activerecord-deprecated_finders (1.0.3)
Using polyglot (0.3.4)
Using arel (4.0.2)
Using sass (3.3.4)
Using coffee-script-source (1.7.0)
Using execjs (2.0.2)
Using thor (0.19.1)
Using hike (1.2.3)
Using json (1.8.1)
Using pg (0.15.1)
Using bundler (1.5.2)
Using tilt (1.4.1)
Using rails_serve_static_assets (0.0.2)
Using rails_stdout_logging (0.0.3)
Using thread_safe (0.3.1)
Using treetop (1.4.15)
Using uglifier (2.1.1)
Using rdoc (3.12.2)
Using rails_12factor (0.0.2)
Using activesupport (4.0.4)
Using mail (2.5.4)
Using sdoc (0.3.20)
Using activemodel (4.0.4)
Using jbuilder (1.0.2)
Using rack-test (0.6.2)
Using activerecord (4.0.4)
Using actionpack (4.0.4)
Using actionmailer (4.0.4)
Using railties (4.0.4)
Using jquery-rails (3.0.4)
Using coffee-script (2.2.0)
Using coffee-rails (4.0.1)
Using turbolinks (1.1.1)
Installing sprockets (2.11.0)
Using sprockets-rails (2.0.1)
Using rails (4.0.4)
Using sass-rails (4.0.1)
Installing bootstrap-sass (2.3.2.0)
Your bundle is complete!
Gems in the groups development and test were not installed.
It was installed into ./vendor/bundle
Bundle completed (8.36s)
Cleaning up the bundler cache.
Removing sprockets (2.12.0)
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
I, [2014-05-08T09:29:54.385001 #707] INFO -- : Writing /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/public/assets/rails-9526610ae44d9e73134fd4337d78a4bb.png
I, [2014-05-08T09:29:59.414656 #707] INFO -- : Writing /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/public/assets/application-354cc53e50f2562d96d57a34facbc739.js
rake aborted!
NoMethodError: undefined method `link_to' for #<#<Class:0x007f34511a3ad8>:0x007f34503d11f8>
(in /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/app/assets/stylesheets/_footer.html.erb)
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/app/assets/stylesheets/_footer.html.erb:8:in `block in singleton class'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/app/assets/stylesheets/_footer.html.erb:-5:in `instance_eval'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/app/assets/stylesheets/_footer.html.erb:-5:in `singleton class'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/app/assets/stylesheets/_footer.html.erb:-7:in `__tilt_69931320843940'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `call'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `evaluate'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:197:in `block in evaluate'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `each'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `evaluate'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/processed_asset.rb:12:in `initialize'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:374:in `new'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:374:in `block in build_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:395:in `circular_call_protection'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:373:in `build_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `block in build_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/bundled_asset.rb:16:in `initialize'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `new'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `build_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `block in build_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:257:in `benchmark'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:210:in `find_asset'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:119:in `block in compile'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `each'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `compile'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-2.11.0/lib/rake/sprocketstask.rb:146:in `with_logger'
/tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app
To git@heroku.com:vast-brushlands-3575.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:vast-brushlands-3575.git'
答案 0 :(得分:2)
这是您的细读错误:
NoMethodError: undefined method `link_to' for #<#<Class:0x007f34511a3ad8>:0x007f34503d11f8>
(in /tmp/build_9f6acb94-a718-4de8-8d46-b7b035805102/app/assets/stylesheets/_footer.html.erb)
正如@Merek
所指出的那样,您的_footer.html.erb
文件夹中有assets/stylesheets
个文件。由于rake assets:precompile
基本上需要你的CSS&amp;把它变成预编译的代码,它说它不能处理link_to
删除文件,重新启动并重新推送到Heroku。它应该有效,除非你有其他的胭脂文件