我不知道该怎么办。它在包含erb :RUSure
的行上给出了这个错误我不明白为什么它与我使用的任何其他行不同erb :whateverFileName
并不是它在不同的目录中,因为它在同一目录中。
我的错误:
2015-05-30T21:50:59.901059+00:00 app[web.1]: 2015-05-30 21:50:59 - Errno::ENOENT - No such file or directory @ rb_sysopen - /app/views/RUSure.erb:
如果这有用,我的树:
.
├── Gemfile
├── Gemfile.lock
├── Procfile
├── Rakefile
├── app.rb
├── db
│ ├── migrate
│ │ └── 20150527124739_establish_all.rb
│ └── schema.rb
├── models.rb
└── views
├── RUSure.erb
├── changePassword.erb
├── createQuiz.erb
├── deleteStu.erb
├── displayAns.erb
├── editDB.erb
├── error.erb
├── getQN.erb
├── home.erb
├── layout.erb
├── noneFound.erb
├── select.erb
├── setPass.erb
├── sucess.erb
└── test.erb
以下是抛出错误的部分:
post '/adminRUSureDelete' do
admin_check
@name = params[:name]
@year = params[:year]
@band = params[:band]
if @name == "" and @year == "" and @band == "" then
var = nil
elsif @name == "" and @year == "" then
var = Student.where(band:@band)
elsif @year == "" and @band == "" then
var = Student.where(name:@name)
elsif @name == "" and @band == "" then
var = Student.where(year:@year)
elsif @name == "" then
var = Student.where(year:@year,band:@band)
elsif @year == "" then
var = Student.where(band:@band,name:@name)
elsif @band == "" then
var = Student.where(year:@year,name:@name)
else
var = Student.where(year:@year,name:@name,band:@band)
end
if var == nil then
erb :noneFound
else
var.each do |i|
@list = "#{@list}<p>#{i.name}</p>"
end
var.each do |i|
@send = "#{@send},#{i.id}"
end
erb :RUSure # THIS IS THE LINE WHERE IT GIVES ME THE ERROR.
# It works if any of the other if statements are triggered, but just not here.
end
end
我愿意添加任何有用的信息。
答案 0 :(得分:1)
该文件使用大写字符。确保代码中的文件名和名称匹配以防万一。如果文件名是真的,例如RUsure.erb
然后您的代码将无效。
答案 1 :(得分:0)
好像它可能正在寻找以/ app开头的绝对路径。您可能希望确保将其用作相对路径或将Rails.root添加到文件路径。