Ruby on Rails Friday, November 26, 2010

On 26 November 2010 14:22, Ben Woodall <lists@ruby-forum.com> wrote:
> [...]
> ===============================
>  NoMethodError in Knodes#new
>
> Showing .../app/views/knodes/_new_form.html.erb where line #1 raised:
>
> undefined method `knodes_index_path' for
> #<#<Class:0xb65df780>:0xb65d71d4>
>
> Extracted source (around line #1):
>
> 1: <% form_for @knodes do |f| %>
> 2:   <% if @knodes.errors.any? %>
> 3:     <div id="error_explanation">
> 4:       <h2><%= pluralize(@knodes.errors.count, "error") %> prohibited
> this knode from being saved:</h2>
> =================================
>
> So I guess this is a new problem all together.  Taking the line:
>
> { :action => :edit }
>
> out of the _form.html.erb for edit makes it work btw.  I guess my
> problem is with the NoMethodError in Knodes#new

I am a bit confused about you naming for Knodes. In an earlier post you have
def new
@knodes = Knodes.new
end
which suggests that your model is class Knodes, and you seem to be
using knodes for both the singular and plural. Rails can get confused
if you do not follow the conventions, though it is possible to work
around this. I would have expected, though, to see model Knode in
model/knode.rb, and controller KnodesController in
controllers/knodes_controller.rb. Whether this is part of your
problem I do not know.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment