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

  • Home
  • SEARCH
  • 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 5988431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:57:26+00:00 2026-05-22T22:57:26+00:00

I have a very simple form, with the scaffold controller action. the DB schema

  • 0

I have a very simple form, with the scaffold controller action. the DB schema for the relevant is as follows:

  create_table "uploads", :force => true do |t|
    t.string   "name"
    t.string   "location"
    t.string   "type"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "filename" 
  end

When the form is submitted, the params contains the following (look at the specific type parameter):

{"utf8"=>"✓",
 "authenticity_token"=>"NGV4rS/tZDWg2ZdMLpiSbTJQBDmMyjfYyZqZ6GX/7Kc=",
 "upload"=>{"name"=>"AEGFAEF",
 "type"=>"Sales",
 "file"=>#<ActionDispatch::Http::UploadedFile:0x4dff958 @original_filename="Google.pdf",
 @content_type="application/pdf",
 @headers="Content-Disposition: form-data; name=\"upload[file]\"; filename=\"Google.pdf\"\r\nContent-Type: application/pdf\r\n",
 @tempfile=#<File:C:/Users/kaya/AppData/Local/Temp/RackMultipart20110602-2876-1wyskk3>>},
 "commit"=>"Create Upload"}

the first command in the create action of UploadsController is

@upload = Upload.new(params[:upload])

and right after this line I have

@upload.type = nil

I really don’t get how such a basic thing is failing. can someone please give a hand?

thanks a bunch in advance.

  • 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-22T22:57:27+00:00Added an answer on May 22, 2026 at 10:57 pm

    In rails type is a MagicFieldName and it is reserved for table inheritance. Since in your case Upload doesn’t inherit from anything, querying type on an object will return nil.

    It is known that using MagicFieldNames as columns names causes lots of troubles. You can check
    http://oldwiki.rubyonrails.org/rails/pages/MagicFieldNames for a full list.

    “Rails values convention over configuration. This is also true in the realm of table design where fields given particular names automatically gain certain behaviours.

    Active Record allows inheritance by storing the name of the class in a column that by default is called “type” (can be changed by overwriting Base.inheritance_column).”

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

Sidebar

Related Questions

Ok, so I have a very simple form with next to no logic in
I am posting a very simple form using a method I have used frequently
I have very simple form along with two database tables. In this form is
I have a very simple form with a name field and two submit buttons:
I have a VERY simple windows form that the user uses to manage Stores.
I have a very simple form where users can enter their email and click
Let's assume I have a very simple form, with a submit button and a
I have a very simple PHP form, which shows a checkbox, and will store
I have a very simple HTML form, only containing a submit button and a
I have a simple html input textbox in a very simple form. the information

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.