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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:18:37+00:00 2026-05-18T06:18:37+00:00

Controllor: def new(user) @address = Address.new @address.user_id = user.id end The link I click

  • 0

Controllor:

  def new(user)
    @address = Address.new
    @address.user_id = user.id
  end

The link I click that triggers the error

<%= link_to "Add Address", new_address_path(current_user)%>

Address model

  belongs_to :user

User Model

  has_many :addresses

New Address View

<h1>New Address</h1>

<% form_for @address, :url => new_address_path do |f| %>
  <%= f.error_messages %>
  <%= render :partial => "form", :object => f %>
  <%= f.submit "Add Address" %>
<% end %>

Schema for Addresses

  create_table "addresses", :force => true do |t|
    t.string  "number"
    t.string  "street"
    t.string  "city"
    t.string  "state"
    t.string  "zip_code"
    t.integer "user_id"
  end

my routes

  map.resources :users
  map.resources :addresses

And the error is

uninitialized constant AddressesController
Parameters:

{"format"=>"#<user:0x105498c60>"}
  • 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-18T06:18:38+00:00Added an answer on May 18, 2026 at 6:18 am

    In what controller is this method placed:

     def new(user)
        @address = Address.new
        @address.user_id = user.id
     end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my relationships_controller I have the following: class RelationshipsController < ApplicationController def new @user_id
In my relationships_controller I have the following: class RelationshipsController < ApplicationController def new @user
My save method in controller: def save = { def userInstance = new User(params)
My Controller (User Controller) def reset_password @user = User.find_by_reset_code(params[:reset_code]) unless params[:reset_code].nil? if request.post? if
My Controller (User Controller) def reset_password @user = User.find_by_reset_code(params[:reset_code]) unless params[:reset_code].nil? if request.post? if
I want to sum columns. In my controller def index @performance_reports = PerformanceReport.all end
I have the following application_controller method: def current_account @current_account ||= Account.find_by_subdomain(request.subdomain) end Should I
def filters = { forUser(controller:'user', action:'*') { before = { user=springSecurityService.getCurrentUser() log.info(came to filter
So I am trying to make a link to user's profile! So I have
I'm getting 'Can't mass-assign protected attribute' error when trying to save a form that

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.