Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8839817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:19:19+00:00 2026-06-14T10:19:19+00:00

I have a program that stores details of sauces. Basically when I get to

  • 0

I have a program that stores details of sauces.
Basically when I get to the edit form, im doing everything im supposed to be doing, the id is passed through successfully, however all the form fields stay empty rather than having the values that are already in the database displayed in them.

In my controller :

def edit 
 @sauce = Sauce.find(params[:id])
 @pagetitle = "Edit #{@sauce.name} Sauce"
end

def update
 # Find object using form parameters
 @sauce = Sauce.find(params[:id])
 # Update the object
 if @sauce.update_attributes(params[:page])
   # If update succeeds, redirect to the list action
   flash[:notice] = "Sauce updated."
   redirect_to(:action => 'list')
 else
   # If save fails, redisplay the form so user can fix problems
   render('edit')
 end 

The form Partial :

<%= error_messages_for(@sauce) %> 
 <table summary="Sauces Form Fields">
  <tr>
   <th><%= f.label(:name,"Sauce Name") %></th>
   <td><%= f.text_field(:name) %></td>
  </tr>
  <tr>
   <th><%= f.label(:description, "Description") %></th>
   <td><%= f.text_area(:description, :size => '40x5') %></td>
  </tr>
  <tr>
   <th><%= f.label(:heat_level, "Heat Level") %></th>
   <td><%= f.select(:heat_level,{ 1 => "1", 2 => "2", 3 => "3", 4 => "4", 5 => "5"}) %></td>
  </tr>
  <tr>
   <th><%= f.label(:pic_url, "Picture URL") %></th>
   <td><%= f.text_field(:pic_url) %></td>
  </tr>
  <tr>
   <th><%= f.label(:title_colour, "Title Colour") %></th>
   <td><%= f.text_field(:title_colour) %></td>
  </tr>
  <tr>
   <th><%= f.label(:description_colour, "Desc Colour") %></th>
   <td><%= f.text_field(:description_colour) %></td>
  </tr>
 </table>

my edit.html.erb

<%= form_for(:subject, :url => {:action => 'update', :id => @sauce.id}) do |f| %>
<%= render(:partial => "form", :locals => {:f => f}) %>  
<%= submit_tag("Update Subject") %>
<% end %>

Where am I going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:19:20+00:00Added an answer on June 14, 2026 at 10:19 am

    The error is form_for(:subject). If you want Rails to correctly fill in the form, you need to use the same symbol as the instance variable has, or just the instance variable. Try this instead:

    <%= form_for(@sauce, :url => {:action => 'update', :id => @sauce.id}) do |f| %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C program that stores some object in java store using JNI.
I have a program that stores user projects as databases. Naturally, the program should
I have a program that stores it's information in an XML file. This file
I have a program in C++ that has a BYTE array that stores some
I have a program that stores data in objects in memory that you can
I have a Java program that stores a lot of mappings from Strings to
I have program that requires Python 3, but I develop Django and it uses
I have program that has a variable that should never change. However, somehow, it
I have program that runs fast enough. I want to see the number of
I have a program that gets a JSON from the server using getJSON and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.