How to use form_for helper in rails?-Collection of common programming errors

New to rails. I am using form_for helper in rails 2.3.5. The question is, when editing a record, I cannot use:

{:action => :update} %> ...

But I have to use:

{:action => :update} %> ... # the same as above

When I use the first code, it always return error saying undefined method. Shouldn’t the first code and the second code serves the same when “myrecord” is the name of the instance passed from controller to view?

Thank you for any hints and answers.

  1. form_for take a block so it’s more like. If this record is same that resource, the :url option is not needed. FormHelper check if @myrecord is #new_record? or not. If new_record use POST instead use PUT.

    
     
      
    
    

Originally posted 2013-11-09 22:43:59.