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 9299495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:34:26+00:00 2026-06-18T22:34:26+00:00

I have the following code in my entries_controller.rb def update @entry = Entry.find(params[:id]) puts

  • 0

I have the following code in my “entries_controller.rb”

 def update
     @entry = Entry.find(params[:id])
     puts "received HTTP request to update old entry:#{@entry.inspect} with"
     puts "new parameters: #{params}"
     if @entry.update_attributes(params[:entry])
       puts"Update was successful"
       @entry2 = Entry.find(params[:id])
       puts "Here is the new value #{@entry2.inspect}"
     end
  end

When I send a put request to the server from my client my console shows this:

  2013-02-17T20:12:25+00:00 app[web.1]: received HTTP request to update old 
  entry:#<Entry id: 1, created_at: "2013-02-17 19:17:40", updated_at: "2013-02-17 19:17:40", 
  description: "Test", title: "Home", category: "-1", latitude: "49.258061", longitude: "-123.153972", hasPhoto: false> with

  2013-02-17T20:12:25+00:00 app[web.1]: new parameters: {"description"=>"Test", "id"=>"1", "category"=>"-1", "hasPhoto"=>"0", "latitude"=>"49.258061", "longitude"=>"-123.153972", 
  "title"=>"Updated home", "action"=>"update", "controller"=>"entries", "format"=>"json"}

  2013-02-17T20:12:25+00:00 app[web.1]: Update was successful

  2013-02-17T20:12:25+00:00 app[web.1]: Here is the new value #<Entry id: 1, created_at: "2013-02-17 19:17:40", updated_at: "2013-02-17 19:17:40", description: "Test", 
  title: "Home", category: "-1", latitude: "49.258061", longitude: "-123.153972", hasPhoto: false>

As you can see the old record was not really updated. Even though the if clause was evaluated to be true. See the value for “title” didn’t change from “Home” to “Updated Home”.

Im wondering whats the bug in this? Its saying that it updated but it didn’t really update.

Can someone help me to understand this please?

Thanks

  • 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-18T22:34:27+00:00Added an answer on June 18, 2026 at 10:34 pm

    What’s happening is that within your view file you are not setting up the appropriate form in your view. Your parameters are returning as this

    {"description"=>"Test", "id"=>"1", "category"=>"-1", "hasPhoto"=>"0", "latitude"=>"49.258061", "longitude"=>"-123.153972", 
      "title"=>"Updated home", "action"=>"update", "controller"=>"entries", "format"=>"json"}
    

    When in reality they should be returning as this…

    {"entry" => {"description"=>"Test", "id"=>"1", "category"=>"-1", "hasPhoto"=>"0", "latitude"=>"49.258061", "longitude"=>"-123.153972", 
      "title"=>"Updated home"}, "action"=>"update", "controller"=>"entries", "format"=>"json"}
    

    Notice the difference? Your parameters regarding entry are wrapped up and attached to the attribute entry. That way when Rails looks at your parameters, it knows which parameters are for your newly updated entry. Without looking at your forms, there isn’t a way to tell you how to specifically fix it, but here’s a good place to start.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code which takes a normal HTTP GET Request and returns
I have the following code: @selected_authors = Author.find(:all, :conditions => [AUT_OID in (?),@selected_authors_array ])
I have the following code in a db update script: set @index1 = ifnull((select
I have the following code to validate two text box entries to make sure
I have the following code (only sections of it) for getting the entries in
I have the following code: entries=(Wet\ Picnic Arizona\ Jones Bikeboy) for arg in ${entries[@]};
I have following code in initialization im = imread('Image02.tif'); figure(); imagesc(im); colormap(gray); [hImage hfig
I have following code <div id=main> <div id=one> </div> <div id=two> </div> <div id=three>
I have following code for updating user's column public void UpdateLastModifiedDate(string username) { using
I have following code for loading image from url in xml parsing endElement method

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.