这是一个 Rails 的报错列表
undefined method 'empty?' for 5000:Integer
simple_format
方法了。将原来的 <%= simple_format(@job.wage_upper_bound) %>
修改为 <%= @job.wage_upper_bound %>
check_controller_and_action is not a supported controller name. This can lead to potential routing problems.
This can lead to potential routing problems.
,大致推断,可能与 routes.rb
有关。检查后发现多了一行,只有 resources
,去掉后问题解决。
rm file1 file2
mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
rm app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
rm file1 file2
这样它会将 file1 与 file2 一并删除,而实际情况是 file1 是存在的,所以被删除掉了。而 file2 却是不存在的,所以它提示 No such file or directory
Routing Error: undefined local variable or method
protected
for main: Object
Routing Error
,首先考虑可能是 config/routes.rb
,检查后发现并没有问题protected
,此为 controller 中定义的方法,接着查看 jobs_controller.rb
就发现问题了。其实就是关闭的 end
的位置不对引起的。rails s
非正常关闭或试图再次打开: kill -9 $(lsof -i tcp:3000 -t)
fatal in Admin::JobsController#publish : exception reentered
exception reentered
,搜索了一下,好像都与无限循环有关。可能是循环调用了相同的方法。params
的方法,而在这个方法内又有 params.require(:job)
也就是又调用了 params
,于是就出现循环调用。NameError in Admin : undefined local variable or method ‘job_params’
job_params
这个方法时,却在下面找不到jobs_params
NameError : undefined local variable or method
“Logout”' for
Logout
左右两边的引号为中文的引号ArgumentError: No association found for name
profile'. Has it been defined yet?
`
:profile
之前调用 :profile
了,顺序换一下。1 error prohibited this person from being saved: Tickets event must exist
has_many :tickets, :dependent => :destroy
belongs_to :event
has_many
修改如下,问题解决。
has_many :tickets, inverse_of: :event, :dependent => :destroy
AASM::UnknownStateMachineError (There is no state machine with the name ‘default’ defined in Object)
include AASM
那一块放到类的定义之外了。NameError: uninitialized constant Product::ImageUploader
bundle install
,之后再次重启 rails 问题竟然消失了。上一篇 下拉菜单不起作用