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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:43:03+00:00 2026-06-13T04:43:03+00:00

Newbie working on his first rails application after studying Hartl’s Rails Tutorial book &

  • 0

Newbie working on his first rails application after studying Hartl’s Rails Tutorial book & video cast.

I’m using a STI model where:

class User < ActiveRecord::Base
class Kid < User
class Parent < User

User has the basic elements: name, email, etc.

The problem I’m having is with routing. I continue to work in determining which model will ultimately work best in this situation (STI or polymorphic). I’ve started with STI and I think I can get this to work if I can nail down the routing issues.

My problem is my edit is looking for an “update” action in the users controller when I want it to route to kidupdate I’ve been reading many SO posts about STI routing but I can’t seem to figure out why this won’t route correctly.

Rspec test. It the error comes from the “click_button”

describe "with valid information" do
  let(:new_first)   { "New First" }
  let(:new_last)    { "New Last" }
  let(:new_email)   { "new@example.com" }
  before do
    fill_in "First Name",               with: new_first
    fill_in "Last Name",                with: new_last
    fill_in "Email",                    with: new_email
    select  "Kid",  from: "Are you a Kid or Parent"
    fill_in "Password",                 with: kid.password
    fill_in "Confirmation",             with: kid.password
    click_button "Save changes"
  end

Rspec error:

     KidPages edit with valid information 
     Failure/Error: click_button "Save changes"
     AbstractController::ActionNotFound:
       The action 'update' could not be found for UsersController
     # (eval):2:in `click_button'
     # ./spec/requests/kids_pages_spec.rb:32:in `block (4 levels) in <top (required)>'

Routes:

       root        /                         static_pages#home
       help        /help(.:format)           static_pages#help
    contact        /contact(.:format)        static_pages#contact
     signup        /signup(.:format)         users#new
     signin        /signin(.:format)         sessions#new
    signout DELETE /signout(.:format)        sessions#destroy
    kidshow        /kids/:id(.:format)       users#kidshow
  kidupate PUT    /kids/:id(.:format)       users#kidupdate
    kidedit        /kids/:id/edit(.:format)  users#kidedit
      users GET    /users(.:format)          users#index
            POST   /users(.:format)          users#create
   new_user GET    /users/new(.:format)      users#new
  edit_user GET    /users/:id/edit(.:format) users#edit
       user GET    /users/:id(.:format)      users#show
            PUT    /users/:id(.:format)      users#update
            DELETE /users/:id(.:format)      users#destroy
   sessions POST   /sessions(.:format)       sessions#create
new_session GET    /sessions/new(.:format)   sessions#new
    session DELETE /sessions/:id(.:format)   sessions#destroy

routes.rb

  root to: 'static_pages#home'
  match '/help',    to: 'static_pages#help'
  match '/contact', to: 'static_pages#contact'
  match '/signup',  to: 'users#new'
  match '/signin',  to: 'sessions#new'
  match '/signout',  to: 'sessions#destroy', via: :delete
  match 'kids/:id', to: 'users#kidshow',  :as => 'kidshow'
  match 'kids/:id', to: 'users#kidupdate', :via => 'put', :as => 'kidupdate'
  match 'kids/:id/edit', to: 'users#kidedit',  :as => 'kidedit'
  resources :users
  resources :sessions, only: [:new, :create, :destroy]

I’ve been struggling with these concepts and this problem for weeks and I appreciate the help.

  • 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-13T04:43:04+00:00Added an answer on June 13, 2026 at 4:43 am

    You can organize your controller better to avoid this issue altogether. See below

    routes.rb

    resources :kids 
    resources :parents
    

    This would directly give you named path:

    edit_kid_path(kid_id) 
    edit_parent_path(parent_id)
    

    kids_controller.rb

    class KidsController < ApplicationController
      def update
      end
    end
    

    parents_controller.rb

    class ParentsController < ApplicationController
      def update
      end    
    end
    

    If you want to share controller behavior, You can potentially do

    class KidsController < UsersController
    end
    
    class ParentsController < UsersController
    end
    

    and put the common actions in users_controller.rb and override them in the child controllers.

    The decision on what model relationships to use should be independent of how you structure your controllers. Controllers and routing is one area of consideration. Modeling data is entirely separately consideration. And declaring resources are just shortcuts for some matching routes.

    If you are not going to use users#update etc, declaring resources :users is unnecessary as you are not using any of the routes that declaration provides.

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

Sidebar

Related Questions

I'm a newbie working through Michael Hartl's Tuby on Rails Tutorial and I have
I am a complete newbie in working with a Ruby on Rails (RoR) application.
Hi i'm a newbie working through Hartl. I'm stuck on microposts in Ch 10.
i am newbie to mongoDB ,as i start working with test application (ASP.Net) found
I am a newbie in Rails and am working on a page that enables
I'm a newbie C++ developer and I'm working on an application which needs to
Hi i'm a newbie to iphone application development.. present i'm working on Picasa web
I'm a newbie drupal... I'm working on my first Drupal project. I need to
I'm a C# newbie who's having problems understanding why his first attempt at understanding
Newbie Alert: while working on my android application my program was acting kind of

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.