Rails 3.1rc5 index_path 未定义方法

发布于 2024-11-28 15:10:01 字数 1447 浏览 0 评论 0原文

我被这个愚蠢的表单阻止:

我有一个 mn 关系:

class Elementtype < ActiveRecord::Base

  has_many :elementtypeproperties

class Propertytype < ActiveRecord::Base

  has_many :elementtypeproperties


class Elementtypeproperties < ActiveRecord::Base

  belongs_to :elementtype
  belongs_to :propertytype

我创建了这个表单:

<%= simple_form_for @elementtypeproperty  do |form| %>


    <%=form.collection :elementtype_id%>
    <%=form.collection :propertytype_id%>

    <%= form.button :submit %>



<% end %>

包含在此视图中:

<h1>New elementtypeproperty</h1>

<%= render 'form' %>

<%= link_to 'Back', elementtypeproperties_path %>

当我尝试打开该页面时,我收到以下消息:

ActionView::Template::Error (undefined method `elementtypeproperties_index_path' for #<#<Class:0x000001010b51d8>:0x000001010a5fa8>):
    1: <%= simple_form_for @elementtypeproperty  do |form| %>
    2: 
    3: 
    4:     <%=form.collection :order_id%>
  app/views/elementtypeproperties/_form.html.erb:1:in `_app_views_elementtypeproperties__form_html_erb__3568906133403572328_2153973000'
  app/views/elementtypeproperties/new.html.erb:3:in `_app_views_elementtypeproperties_new_html_erb__1519898890038681767_2154367600'
  app/controllers/elementtypeproperties_controller.rb:29:in `new'

出了什么问题?谢谢!!!

I'm blocked with this stupid form:

I have a m-n relationship:

class Elementtype < ActiveRecord::Base

  has_many :elementtypeproperties

class Propertytype < ActiveRecord::Base

  has_many :elementtypeproperties


class Elementtypeproperties < ActiveRecord::Base

  belongs_to :elementtype
  belongs_to :propertytype

I created this form:

<%= simple_form_for @elementtypeproperty  do |form| %>


    <%=form.collection :elementtype_id%>
    <%=form.collection :propertytype_id%>

    <%= form.button :submit %>



<% end %>

Included in this view:

<h1>New elementtypeproperty</h1>

<%= render 'form' %>

<%= link_to 'Back', elementtypeproperties_path %>

When I try to open the page, I get following message:

ActionView::Template::Error (undefined method `elementtypeproperties_index_path' for #<#<Class:0x000001010b51d8>:0x000001010a5fa8>):
    1: <%= simple_form_for @elementtypeproperty  do |form| %>
    2: 
    3: 
    4:     <%=form.collection :order_id%>
  app/views/elementtypeproperties/_form.html.erb:1:in `_app_views_elementtypeproperties__form_html_erb__3568906133403572328_2153973000'
  app/views/elementtypeproperties/new.html.erb:3:in `_app_views_elementtypeproperties_new_html_erb__1519898890038681767_2154367600'
  app/controllers/elementtypeproperties_controller.rb:29:in `new'

What's wrong? Thanks!!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

二手情话 2024-12-05 15:10:01

解决了,由于迁移错误,我的模型是复数的。

Solved, my model was plural due to a mistake in the migrations.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文