#<#<Class:0x0 的未定义方法 'pathname'
Undefined method 'pathname' for #<#<Class:0x0
我更新了项目的 Ruby 和 Rails 版本。
Ruby 2.2.3
–> 2.5.1
Rails 4.1.8
–> 5.1.7
现在当我启动服务器时,我得到这个错误:
F, [2020-02-03T11:15:49.912385 #92132] FATAL -- : ActionView::Template::Error (undefined method `pathname' for #<#<Class:0x00007f8f8859d7c8>:0x00007f8f8a06a2b8>
Did you mean? path_to_image):
F, [2020-02-03T11:15:49.913172 #92132] FATAL -- : 21:
22: %title= content_for?(:title) ? yield(:title) : "Rado"
23: = csrf_meta_tags
24: = stylesheet_link_tag "application", media: 'all'
我的application.css:
*= require_tree ./lib
*= require_directory .
*= require_self
*= require jquery.fileupload
*= require jquery.fileupload-ui
*= require select2
*= require select2-bootstrap
*= require switchery
...and some css
错误不依赖于application.css的内容。我试图删除文件中的所有内容,但仍然出现错误。
error img
如果我 运行 rake assets:precompile
,我得到同样的错误:
rake aborted!
NoMethodError: undefined method `pathname' for #<#<Class:0x00007fea873db638>:0x00007fea80715df0>
Did you mean? path_to_image
就我而言,发生错误是因为我安装了 twitter-bootstrap-rails
gem 并且 bootstrap_and_overrides.less
文件位于 stylesheets 文件夹以使用 Less 样式表。
所以我刚刚安装了静态样式表 - rails generate bootstrap:install static
文件 bootstrap_and_overrides.less
已重命名为 *bootstrap_and_overrides.css*
并将内容替换为:
/*
*=require twitter-bootstrap-static/bootstrap
Static version of css will use Glyphicons sprites by default
=require twitter-bootstrap-static/sprites
*/
如果你也用这个gem,look at Github.
但是我还是不明白为什么会出现这个错误。
我更新了项目的 Ruby 和 Rails 版本。
Ruby 2.2.3
–> 2.5.1
Rails 4.1.8
–> 5.1.7
现在当我启动服务器时,我得到这个错误:
F, [2020-02-03T11:15:49.912385 #92132] FATAL -- : ActionView::Template::Error (undefined method `pathname' for #<#<Class:0x00007f8f8859d7c8>:0x00007f8f8a06a2b8>
Did you mean? path_to_image):
F, [2020-02-03T11:15:49.913172 #92132] FATAL -- : 21:
22: %title= content_for?(:title) ? yield(:title) : "Rado"
23: = csrf_meta_tags
24: = stylesheet_link_tag "application", media: 'all'
我的application.css:
*= require_tree ./lib
*= require_directory .
*= require_self
*= require jquery.fileupload
*= require jquery.fileupload-ui
*= require select2
*= require select2-bootstrap
*= require switchery
...and some css
错误不依赖于application.css的内容。我试图删除文件中的所有内容,但仍然出现错误。
error img
如果我 运行 rake assets:precompile
,我得到同样的错误:
rake aborted!
NoMethodError: undefined method `pathname' for #<#<Class:0x00007fea873db638>:0x00007fea80715df0>
Did you mean? path_to_image
就我而言,发生错误是因为我安装了 twitter-bootstrap-rails
gem 并且 bootstrap_and_overrides.less
文件位于 stylesheets 文件夹以使用 Less 样式表。
所以我刚刚安装了静态样式表 - rails generate bootstrap:install static
文件 bootstrap_and_overrides.less
已重命名为 *bootstrap_and_overrides.css*
并将内容替换为:
/*
*=require twitter-bootstrap-static/bootstrap
Static version of css will use Glyphicons sprites by default
=require twitter-bootstrap-static/sprites
*/
如果你也用这个gem,look at Github.
但是我还是不明白为什么会出现这个错误。