Couldn't find without an ID

Hello all. I'm new to RoR. I am having trouble trying to get a simple
edit/update going. Everytime I hit submit, I get the following error:

If you did not use a generator to make your scaffolding, then you may
not have your routes set up correctly. new might be calling edit so
there is not parameter.

The one bit of information you've missed out there is the url your
form has posted to. It should be something like:

The number at the end of the URL is the id of the "content" record you
are trying to update. If it's missing something's wrong somewhere. If
you view source of the html page before you post the form, where does
the form say it's going to post to?

Yup, there's no id param there, and the format value is messed up for
some reason. Even though your code looks fine to me at first glance.

What does your routes.rb file look like?



Thanks for your replies. I didn't use / or generate scaffolding for
this project. Here is what my routes.rb looks like:

ActionController::Routing::Routes.draw do |map|

  map.resource :content
  map.resource :weblink
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'

After doing a view-source on my form before submission, here's what I

<form action="/content.%23%3Ccontent:0x373ac10%3E"
class="edit_content" id="edit_content_2" method="post"><div
style="margin:0;padding:0;display:inline"><input name="_method"
type="hidden" value="put" /><input name="authenticity_token"
type="hidden" value="2KH+rzW8Xy68gwDdjceXEqJH2aM69PdV44Hx0UVbooA=" />


Uggh! I can't believe it's that missing 's' that was causing me
heartache. I also changed 'content' to 'contents' and it's working
fine after the update. I guess I need to read more about this
routes.rb file. I still don't have a 100% grasp on it. Thanks all for
your help.


Also, you don't need to wait three days before asking for help. If a
couple of hours of Googling doesn't solve it, you're probably about
ready for new eyes on your problem :slight_smile:

Thanks. Well, I work on my project a few hours a day after work so
it's not exactly 3 straight days. But you're right, sometimes Googling
just isn't enough. I'm glad to have found this group. I'm pretty sure
I'll have a few more questions later. Any other books you can
recommend for Ruby on Rails? I'm starting to love this new framework
after just a few days of experimenting and would like to continue
going deeper. I currently have Simply Rails 2 by Patrick Lenz and
Learning Rails by St. Laurent & Dumbill.

The best book in my opinion is Agile Web Development with Rails (then The Rails Way when you get a bit more advanced).



"Agile Web Development with Rails" was my first introduction, and it
still proves to be very useful. I was frustrated by "The Rails Way"
(or at least the edition I had) as it was peppered with typos - and
when you're trying to learn a programming language, errors in the
example code are frustrating.

Another great medium-level book is "Ruby for Rails" (if you can ignore
the cover!). It does skim the basics, but then gets on with the good

I can't recommend highly enough "Refactoring: Ruby Edition" - not
strictly a Rails book, but very good for developing your programming
skills generally, and Ruby specifically.