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

  • Home
  • SEARCH
  • 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 6624053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:36:23+00:00 2026-05-25T21:36:23+00:00

Can I update my nested resource without going through the parent class? I put

  • 0

Can I update my nested resource without going through the parent class?

I put this in the routes

    put 'ratings/:id' => 'ratings#update', :as => 'update_ratings'

and I put an exception for [:edit, :update] in the nested resource route

My controller

def update/edit
 @rating = Rating.find(params[:id])
  ...
 end

My edit view:

 <%= form_for(@rating, :url => update_ratings_path(@rating)) do |f| %>

What happens is the server log says the put request happens, but no attributes are updated. The page then redirects to the show action, when it should go to parent class index page.

The log:

Started PUT “/ratings/21” for 127.0.0.1 at 2011-09-25 19:31:18 -0700
Processing by RatingsController#show as HTML
Parameters: {“utf8″=>”✓”, “authenticity_token”=>”g4TkuG1xK8W96VSKdl3ZwedrqIXmcg9CDt6y8IqaFh0=”, “rating”=>{“environ”=>”8”}, “commit”=>”Update Rating”, “id”=>”21”}
Rating Load (0.3ms) SELECT ratings.* FROM ratings WHERE ratings.id = 21 LIMIT 1
Rendered ratings/show.html.erb within layouts/application (9.8ms)
User Load (0.4ms) SELECT users.* FROM users WHERE users.id = 1 LIMIT 1
Completed 200 OK in 151ms (Views: 143.4ms | ActiveRecord: 4.8ms)

  • 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-05-25T21:36:24+00:00Added an answer on May 25, 2026 at 9:36 pm

    From experience I can say that using a nested resource controller for an unnested action often becomes unmanageable in the long run. So be sure it’s not easier to add a second controller. After all, a controller is just an interface to a resource. It’s not a problem to have two interfaces to the same resource.

    Your log shows “Processing by RatingsController#show”, so it never reaches the #update action; instead it comes into #show.

    The most probable cause I can think of is that you have a (named) route on a higher line in routes.rb to the ratings#show action, without a :via => ‘get’.

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

Sidebar

Related Questions

I am using two update panel..in nested way.. can i use like this and
Can I use Update panel in masterpage to wrap nested pages so that when
I know I can update a single record like this - but then how
How can I update some Windows Service Seperated Assemblies without restarting the service? Note:
Im trying to update some nested params from a form. I can see that
I'm having issues displaying values from a nested controller. I can update the field
I can't wrap my head around how to accomplish rendering this public class Shape{}
I've got this basic model, where a provision object, a nested resource of a
How can update a input hidden inside an UpdatePanel on an AsyncPostBack? The user
I see that EF can update a model based on an existing database schema.

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.