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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:27:06+00:00 2026-05-27T06:27:06+00:00

My models: class NewsItem < ActiveRecord::Base has_many :file_uploads, :as => :uploadable accepts_nested_attributes_for :file_uploads, :allow_destroy

  • 0

My models:

class NewsItem < ActiveRecord::Base
  has_many :file_uploads, :as => :uploadable
  accepts_nested_attributes_for :file_uploads, :allow_destroy => true
end


class FileUpload < ActiveRecord::Base
  belongs_to :uploadable, :polymorphic => true
  has_attached_file :upload, :styles => {:thumb => '100x100>'}
end

Form Code (nested within NewsItem)

...

<%= f.fields_for :file_uploads do |upload| %>
  <div class="file_upload">
    <%= upload.file_field :upload %>
  </div>

  ...

<% end %>

...

On submit I get the following error: “unknown attribute: upload”. Here are the params:

{"utf8"=>"✓",
 "authenticity_token"=>"MBfxJ4XTizCXv3Mpu971VHCm60bS3Y84Kdxfe+VJD2w=",
 "news_item"=>{"title"=>"",
 "body"=>"",
 "published_date"=>"",
 "file_uploads_attributes"=>{"0"=>{"upload"=>#<ActionDispatch::Http::UploadedFile:0x000001070112a8 @original_filename="rails-dd352fc2630e5f9aa5685ef1d7fe5997.png",
 @content_type="image/png",
 @headers="Content-Disposition: form-data; name=\"news_item[file_uploads_attributes][0][upload]\"; filename=\"rails-dd352fc2630e5f9aa5685ef1d7fe5997.png\"\r\nContent-Type: image/png\r\n",
 @tempfile=#<File:/var/folders/hb/2bkct63171lck8d3sg0xfq0c0000gn/T/RackMultipart20111204-3216-71in7a>>,
 "name"=>"",
 "caption"=>""}}},
 "commit"=>"Create News item"}

I’m using Rails 3.1.3 and paperclip “~> 2.4”.

  • 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-27T06:27:07+00:00Added an answer on May 27, 2026 at 6:27 am

    Restarting the rails app fixed the problem. I’m guessing I installed the gem but did not restart, leading to the error above. Lesson learned: always restart after installing a gem.

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

Sidebar

Related Questions

Three models: class Customer < ActiveRecord::Base has_many :visits end class Visit < ActiveRecord::Base belongs_to
I have the following models: class FieldEntryValue < ActiveRecord::Base belongs_to :field_entry end and class
Situation # Models class User < ActiveRecord::Base has_many :items end class Items < ActiveRecord::Base
My models: class Contact < ActiveRecord::Base has_many :addresses has_many :emails has_many :websites accepts_nested_attributes_for :addresses,
I have the following models: class User < ActiveRecord::Base has_many :subscriptions end class Subscription
I have the following models class Book < ActiveRecord::Base has_many :chapters end and class
I have 2 models class User < ActiveRecord::Base has_many :products end class Product <
Models: class User < ActiveRecord::Base has_many :attendances has_many :courses, :through => :attendances end class
Assume the following models: class Order < ActiveRecord::Base belongs_to :customer has_many :line_items, :dependent =>
I have two models: class Member < ActiveRecord::Base has_many :member_tags end and class MemberTag

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.