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.

On Tue, Feb 23, 2010 at 6:47 AM, Butterson <jax...@gmail.com> wrote:
> 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:
> +++++++++++++++++++++
> Couldn't find Content without an ID
>
> Request
> Parameters:
> {"format"=>"#<content:0x4d3daac>",
>  "commit"=>"Update",
>  "_method"=>"put",
>  "authenticity_token"=>"axBSuIWVTMRB2CKcmMO59tqtOlMtXRSXQQ7xeHEMd78=",
>  "content"=>{"title"=>"About Us",
>  "verbiage"=>"The company was formed in 2008 by seven healthcare
> professionals involved in the areas of acute care hospital,
>  rehab hospital,
>  skilled nursing and rehab,
>  out-patient clinics,
>  and Home Health Care. Update"}}
>
> +++++++++++++++++++++++++++++
>
> I have a form called edit.html.erb:
> <h2>Edit content</h2>
> <% form_for @content do |f| %>
> <p>
>  <%= f.label :title %><br/>
>  <%= f.text_field :title %>
> </p>
> <p>
>  <%= f.label :verbiage %><br/>
>  <%= f.text_area :verbiage %><br/>
> </p>
>
> <%= f.submit "Update"%>
> <% end %>
> +++++++++++++++++++++++++++++++++++++
>
>
> Here's my controller code:
> class ContentsController < ApplicationController
>  layout 'subpages'
>
>  def new
>   �...@content = Content.new
>  end
>
>
>  def create
>   �...@content = Content.new(params[:content])
>   �...@content.save
>  end
>
>  def edit
>   �...@content = Content.find(params[:id])
>  end
>
>  def update
>     �...@content = Content.find(params[:id])
>     �...@content.update_attributes(params[:content])
>      redirect_to :action => "edit", :id => @content.id
>
>  end
>
> end
> ++++++++++++++++++++++++++++++++++++
>
> i've been trying to figure this out for 3 days but no luck. The
> solutions on the web and books seem to explain that I need to have id
> passed to the controller, but I thought form_for @content should
> already take care of that. I would appreciate all the help i can get.
> Thanks.
>
>
>
> --
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>



-- 
Curtis Cooley
curtis.coo...@gmail.com
home:http://curtiscooley.com
blog:http://ponderingobjectorienteddesign.blogspot.com
===============
Leadership is a potent combination of strategy and character. But if
you must be without one, be without the strategy.
-- H. Norman Schwarzkopf

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to