2011-07-09 73 views
0

我有2模型servicio和caja。钢轨嵌套形式无法找到子模型的方法

SERVICIO,的has_many:卡哈 卡哈,belongs_to的:SERVICIO

,但我不能找到方法servicio.cajas出于某种原因,我能找到servicio.caja寿。我错过了什么?我需要提供更多信息吗?从日志

00:04:57 ActionView::Template::Error (undefined method `cajas' for #<Servicio:0x00000004ae55e8>): 
1: <%= form_for([@servicio, @servicio.cajas.new]) do |f| %> 
2: <div class="field"> 
3:  <%= f.label :tipo_id %><br /> 
4:  <%= f.text_field :tipo_id %> 
app/views/cajas/new.html.erb:1:in `_app_views_cajas_new_html_erb___4360865893086628466_37227020_2289718708193017139' 
app/views/servicios/show.html.erb:68:in `_app_views_servicios_show_html_erb__559030007672389687_39240460_2289718708193017139' 
app/controllers/servicios_controller.rb:18:in `show' 
+0

不需要回答这个问题,我找到了根,我会加上答案。 –

回答

0

消息我发现的根源。我在定义has_many时发生了错误:cajas,我以前有has_many:caja。