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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:36:28+00:00 2026-06-07T00:36:28+00:00

As the error message stated below, I do not use user_profiles_path as plural because

  • 0

As the error message stated below, I do not use “user_profiles_path” as plural because I defined “resource :profile” in nested resource.

NoMethodError in Profiles#new

Showing /home/smileymike/rails_projects/bffmapp_v2/app/views/profiles/new.html.erb where line #20 raised:

undefined method `user_profiles_path' for #<#<Class:0x90266ac>:0xa041294>

Model:

class User < ActiveRecord::Base
  has_one :profile

class Profile < ActiveRecord::Base
  attr_accessible :name, :surname
  belongs_to :user

routes.rb:

  resources :users do
    resource :profile  (note: has_one)
  end

view: profiles/new.html.erb

<div class="row">
  <div class="span6 offset3">
    <%= form_for([@user, @profile]) do |f| %>
      <%= f.label :name %>
      <%= f.text_field :name %>

      <%= f.label :surname %>
      <%= f.text_field :surname %>

      <%= f.submit "Create my profile", class: "btn btn-large btn-primary" %>
    <% end %>
  </div>
</div>

routes

    user_profile POST   /users/:user_id/profile(.:format)      profiles#create
 new_user_profile GET    /users/:user_id/profile/new(.:format)  profiles#new
edit_user_profile GET    /users/:user_id/profile/edit(.:format) profiles#edit
                  GET    /users/:user_id/profile(.:format)      profiles#show
                  PUT    /users/:user_id/profile(.:format)      profiles#update
                  DELETE /users/:user_id/profile(.:format)      profiles#destroy
            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
             root        /                                      static_pages#home
           signup        /signup(.:format)                      users#new
           signin        /signin(.:format)                      sessions#new
          signout DELETE /signout(.:format)                     sessions#destroy
             help        /help(.:format)                        static_pages#help
            about        /about(.:format)                       static_pages#about
          contact        /contact(.:format)                     static_pages#contact

Controller:

class ProfilesController < ApplicationController
    def show
    end

  def new
    @user = current_user
    @profile = current_user.build_profile()
  end

  def edit
  end

  def create
  end

  def update
  end

  def destroy
  end
end

below is an illustrate of current_user in profiles_controller.rb

module SessionsHelper
    def sign_in(user)
    cookies.permanent[:remember_token] = user.remember_token
    self.current_user = user
  end

  def signed_in?
    !current_user.nil?
  end

  def current_user=(user)
    @current_user = user
  end

  def current_user
    @current_user ||= User.find_by_remember_token(cookies[:remember_token])
  end

  def sign_out
    self.current_user = nil
    cookies.delete(:remember_token)
  end
end
  • 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-07T00:36:29+00:00Added an answer on June 7, 2026 at 12:36 am

    Form for using the polymorphic routes like that will always use the pluralized path for new records. You will need to be explicit in your form:

    form_for([@user, @profile], :url => user_profile_path(@user))
    

    Good news though, the create route is the same as the update route.

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

Sidebar

Related Questions

My Error message: Request for member nameField in something not a struct or union
The below piece of code that throws the following exception.. Error Message: Object reference
I am getting the below stated error in javascript. This error occurs when i
I am receiving below hibernate error message while flush.I am iterating in a for
Is it possible to add model state error message during updating properties using TryUpdateModel?
Started practicing with XML and C# and I have an error message of There
I have this error message: Msg 8134, Level 16, State 1, Line 1 Divide
Error message doesn't display on mysql connect failure if( ! $this->remote_connection_id = @mysql_connect($vars['hostname'], $vars['username'],
When error message is a long string, how to make the message be displayed
The error message I gen when I try to access the web page server

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.