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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:49:30+00:00 2026-06-07T23:49:30+00:00

I’m making a website where the user can input data into a database, and

  • 0

I’m making a website where the user can input data into a database, and then can search the database on another page. At the moment the create new entry form works fine, and so does the search page for displaying the tables, as I haven’t implemented the search yet.

Controller:

def search
 @project_search = Project.order(sort_column + " " + sort_direction)
end

  private

   def sort_column
    Project.column_names.include?(params[:sort]) ? params[:sort] : "project_name"
   end

   def sort_direction
    %w[asc desc].include?(params[:direction]) ? params[:direction] : "asc"
   end


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


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

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

When I comment out the search method, my input form then works, but when they are both there, I get this error.

undefined method `model_name’ for NilClass:Class

Extracted Source, from my form view at line 1:

<%= form_for(@project) do |f| %>

I think it’s just a small problem, but I can’t see how to fix it. I am new to ruby on rails, so go easy :).

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-07T23:49:32+00:00Added an answer on June 7, 2026 at 11:49 pm

    Not 100% sure, but I think it’s because of where private is located. In Ruby, everything after that call will be private. Rails may ignore your definition of create and use its own. Any chance you are commenting out private when you say you “comment out the search method”?

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I need to clean up various Word 'smart' characters in user input, including but
I'm making a simple page using Google Maps API 3. My first. One marker
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into

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.