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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:27:01+00:00 2026-05-23T15:27:01+00:00

I have a has_one association between user and setting model. I have also SettingsController

  • 0

I have a has_one association between user and setting model. I have also SettingsController with edit and update actions. On front page I have a link to edit settings:

<%= link_to (settings_path(current_user.setting)), do %>
..
<% end %>

This causing ActionController::RoutingError No route matches {:controller=>”settings”, :action=>”edit”} ..when trying to display front page.

I kinda stuck banging my head around why this is happening. Using Devise for user authentication, this current_user should be a global variable.

Here is how routes are defined in routes.rb:

  resources :setting, :only => [:edit, :update]  
  match '/settings/:id' => "settings#edit", :controller => :setting, :as => :settings

Here is what rake routes is returning:

    edit_setting GET    /setting/:id/edit(.:format)                 {:action=>"edit", :controller=>"setting"}
         setting PUT    /setting/:id(.:format)                      {:action=>"update", :controller=>"setting"}
        settings        /settings/:id(.:format)                     {:controller=>"settings", :action=>"edit"}

Another guess is that controller name (SettingsController) should be singular, not plural when using has_one association. For some strange reason Rails is not noticing my controller, even though it is very present.

Help is appreciated.

  • 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-23T15:27:01+00:00Added an answer on May 23, 2026 at 3:27 pm

    Ok, firts why are you using your own controller for settings for a user instead of devise ?
    that is on edit_user_registration_path

    • Your path it’s ok, it has to be in plural because you defined it in the :as parameter

    Another comment is , if you are using resources :setting, :only => [:edit, :update]
    why are you using the next line ? and that path, I mean, if you declaring it like that, you could use edit_setting_path(id)

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

Sidebar

Related Questions

I have two models with a one-to-one association. class User < ActiveRecord::Base has_one :setting
I have a simple has_one/belongs_to relationship between two models. This is a new association
Edit: I would like to model a 1 to 0:1 relationship between User and
I have a model with a has_one and polymorphic association like this: class Disc
I have a many-to-many association between a User class and a Table class. Additionally,
I have a model called Contact which has_one guest like so. class Contact <
i have to model classes User and Order. what i want is to have
I have a table called SecurityContacts and another table called Contacts. The association between
Im doing a model association between two models that are called Resume and Province.
I have a User and a Gallery model and the following associations: gallery.rb attr_accessible

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.