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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:13:01+00:00 2026-06-04T03:13:01+00:00

My nested form fields for friends will not show no matter what i do..have

  • 0

My nested form fields for friends will not show no matter what i do..have the accepts_nested_attributes setup properly i believe?..

    views/user_steps/show.html.erb

    <%= simple_form_for @user do |f| %>

    <%= f.input :city %>
    <%= f.input :address %>
    <%= f.input :zipcode %>
    <%= f.input :date_of_birth %>
    <%= f.input :gender, :collection => ['male','female'] %>

    <%= f.association :interests, :as => :check_boxes, :label => false %>


    <%= f.association :holidays, :as => :check_boxes, :label => false %>


    <%= f.simple_fields_for :friends do |friend_f| %>
    <%= friend_f.input :name %>
    <%= friend_f.input :dob %>
    <%= friend_f.input :gender %>
     <% end %>

    <%= f.button :submit %>
    <%end%>


class UserStepsController < ApplicationController

  def show
    @user = current_user 
  end

  def update
    @user = current_user
    @user.attributes = params[:user]
    @friend = Friend.new(params[:friend])
  end

  def new
    @user = User.new
    @user.build_friend
  end


end

class UsersController < ApplicationController
  before_filter :authenticate_user!

  def index
    authorize! :index, @user, :message => 'Not authorized as an administrator.'
    @users = User.paginate(:page => params[:page])
  end

  def show
    @user = User.find(params[:id])
  end
  def create
    @user = User.new(params[:user])

    respond_to do |format|
      if @user.save
        format.html { redirect_to @user, notice: 'Friend birthday(1) was successfully created.' }
        format.json { render json: @user, status: :created, location: @user }
      else
        format.html { render action: "new" }
        format.json { render json: @user.errors, status: :unprocessable_entity }
      end
    end
  end

  def update
    @user = User.find(params[:id])

     respond_to do |format|
      if @user.update_attributes(params[:user])
        format.html { redirect_to @user, notice: 'User was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @user.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /users/1
  # DELETE /users/1.json
  def destroy
    @user = User.find(params[:id])
    @user.destroy

    respond_to do |format|
      format.html { redirect_to users_url }
      format.json { head :no_content }
    end
  end
end

class User < ActiveRecord::Base
  attr_accessible :name, :email, :password, :password_confirmation, :interests_attributes, :remember_me, :city, :zipcode, :date_of_birth, :gender, :address, :interest_ids, :holiday_ids
  has_and_belongs_to_many :holidays
  has_and_belongs_to_many :interests
  has_many :friends
  accepts_nested_attributes_for :friends,  allow_destroy: true
  accepts_nested_attributes_for :interests, allow_destroy: true
  accepts_nested_attributes_for :holidays, allow_destroy: true

class Friend < ActiveRecord::Base
  belongs_to :user
  attr_accessible :dob, :gender, :name
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-04T03:13:02+00:00Added an answer on June 4, 2026 at 3:13 am

    My guess is that @user has no friends, so there’s nothing to render.

    If this is creating a new user and you want them to be able to fill in their friends as well, do a @user.friends.build somewhere, which will add an empty friend to them, and should allow the nested fields to render.

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

Sidebar

Related Questions

I have a nested form in which I would like the form fields to
I have a three-level multi-nested form in Rails. The setup is like this: Projects
I have a nested form with 3 related models. I want all the fields
I have a Rails nested form with the child fields that contain dynamic select
I have a nested form Parent, which accepts attribute for Child. In my controller#new,
I have a complicated nested form (Ryan Bates' version) with .live() attached to some
I have a nested form in my app that uses AJAX to load an
I have nested list of the following form: my_list = [['Some1', '2', '3.6', '4.5',
I have the following form for photo_album which uses the nested forms feature of
I have a nested form in a rails view that is called like this

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.