Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 不能';我找不到没有ID的时间表_Ruby On Rails_Ruby_Ruby On Rails 4 - Fatal编程技术网

Ruby on rails 不能';我找不到没有ID的时间表

Ruby on rails 不能';我找不到没有ID的时间表,ruby-on-rails,ruby,ruby-on-rails-4,Ruby On Rails,Ruby,Ruby On Rails 4,生成一个时间表。然后将一个新动作“clas”添加到我的时间表\u controller.rb中 时间表\u controller.rb: class TimetablesController < ApplicationController before_action :set_timetable, only: [:show, :edit, :update, :destroy] respond_to :html def clas @classtimetable = Timeta

生成一个时间表。然后将一个新动作“clas”添加到我的时间表\u controller.rb中

时间表\u controller.rb:

class TimetablesController < ApplicationController
  before_action :set_timetable, only: [:show, :edit, :update, :destroy]
  respond_to :html

def clas
  @classtimetable = Timetable.all
end

private
def set_timetable
  @timetable = Timetable.find(params[:id])
end

def timetable_params
  params.require(:timetable).permit(:day, :clas)
end

end
rake routes | grep时间表:


def clas@classtimeline=时刻表。结束
你忘了写点什么?我希望这是打字错误
@classtimeline=timeline.
,根据你的路线,路径应该是
class\u timetables\u path
。您是如何获得
编辑课程时间表路径的
?我明白了。。从您获得的位置
编辑课程表路径
。。看结果显示我在评论中对你说了什么。您的路线路径错误。请不要添加问题的答案(改为作为单独答案发布)。
<% @classtimetable.each do |class_timetable| %>
  <%= class_timetable.day %>
  <%= class_timetable.clas %>
  <%= link_to 'Edit', edit_class_timetable_path(class_timetable) %>
<% end %>
resources :timetables do
collection do
  get 'clas'
end
end