Ruby on Rails Friday, November 26, 2010

Frederick Cheung wrote in post #964102:
> On Nov 26, 1:53pm, Ben Woodall <li...@ruby-forum.com> wrote:
>
>> =====================
>> <% form_for @knodes, :url => { :action => :edit } do |f| %>
>
> This is incorrect - your form should be submitting to the update or
> create action depending on whether the object is saved or not.
> If you just do <% form_for @knodes do |f| %> rails will handle this
> for you
>
> Fred

Yeah, that's the woeful conclusion I came to. As posted right before
you did, without that line in _new_form.html.erb for a new post, I keep
getting:

===============================
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 this is a new problem than the one I first submitted. Board
etiquette: should I keep this post going for this new problem, or submit
a new one?

I really appreciate the help i've gotten so far btw.

--
Posted via http://www.ruby-forum.com/.

--
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