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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:24:15+00:00 2026-06-08T05:24:15+00:00

I have a form which takes users information and stores it in the database.

  • 0

I have a form which takes users information and stores it in the database. For some of the fields the user can put new information in a field, or select previous info from the database. It was working earlier, however I recently cleaned the database and now I get this error when I try to access the page.

undefined method `empty?’ for nil:NilClass

Extracted source (around line #27):

27: <%= f.select( :client, Project.all.map {|p| [p.client]}.uniq!, :prompt => “Select a previous Client”) %>

Form view example:

<div class="field">
<%= label_tag :new_client, "Client" %><br/>
<%= text_field_tag :new_client %>
Or
<%= f.select( :client, Project.all.map {|p| [p.client]}.uniq!, :prompt => "Select a previous Client") %>
</div>

Project Controller:

def create
@project = Project.new(params[:project])


@project.client = params[:new_client] unless params[:new_client].empty?
@project.exception_pm = params[:new_exception_pm] unless params[:new_exception_pm].empty?
@project.project_owner = params[:new_project_owner] unless params[:new_project_owner].empty?
@project.role = params[:new_role] unless params[:new_role].empty?
@project.industry = params[:new_industry] unless params[:new_industry].empty?
@project.business_div = params[:new_business_div] unless params[:new_business_div].empty?

respond_to do |format|
  if @project.save
    format.html { redirect_to @project, notice: 'Project was successfully created.' }
    format.json { render json: @project, status: :created, location: @project }
  else
    format.html { render action: "new" }
    format.json { render json: @project.errors, status: :unprocessable_entity }
  end
end
end

UPDATE:

I think the error is coming from the .uniq! method in my form view. Any other ideas?

Thanks

  • 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-08T05:24:17+00:00Added an answer on June 8, 2026 at 5:24 am

    I changed from using uniq! to uniq.

    That seemed to solve the problem.

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

Sidebar

Related Questions

i'm using Codeigniter. i have a form which takes information about users. What i
I have a web form in a .aspx form which takes a users details
I have a form-1 which has 4 fields. when the user inputs data in
I have a multipart form that takes basic user information at the beginning with
I have a pretty simple HTML form where users can enter in information about
I have a form which (on a previous page) users can select how many
I have an embedded iframe form which takes a file from a type=file form
i have an form which will send some data to an php file ,
I am building a PHP registration form which takes the following fields for up
I have a web application in which one of the workflows, users can download

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.