【发布时间】:2014-10-12 08:47:02
【问题描述】:
过去 5 小时我一直在尝试解决这个错误,如果我不能解决这个问题,我会烧掉我的电脑。
undefined method `pushes_path' for # 这是我得到的错误代码,但我不明白为什么。
这是我在交互中的 index.html.erb 文件
<%= simple_form_for @push do |f| %>
<%= f.input :payload, as: :text %>
<%= f.input :segment, as: :radio_buttons %>
<%= submit_tag "start the campaign" %>
<% end %>
这是我的交互控制器
class InteractionController < ApplicationController
def index
@push =Push.new
end
end
Push 是我在数据库中的表,我将获取输入并将它们写入数据库以供以后使用。
这是我的路线文件
devise_for :partners
get 'home/index'
get 'segmentation/index'
get 'interaction/index'
root to: "home#index"
我真的不知道它为什么要寻找 pushes_path,我做错了什么?
【问题讨论】:
-
尝试将
resources :pushes添加到您的routes.rb文件中。 -
请不要烧毁你的电脑——没有人喜欢烧毁无辜的电脑!
-
先生,我现在给你写一个答案!
标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-4 routes