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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:34:58+00:00 2026-06-10T06:34:58+00:00

I think everything is fine.. but it doesn’t work.. I uploaded whole files on

  • 0

I think everything is fine.. but it doesn’t work..
I uploaded whole files on github
https://github.com/iom00/action2.git
I recently updated gem. But it has same problem on rails 3.2..
Plz help me~!

portfolio model

class Portf
  include Mongoid::Document
  field :title, type: String
  field :decs, type: String  

  attr_accessible :images
  embeds_many :images
  accepts_nested_attributes_for :images, :allow_destroy => true

end

image model

class Image
  include Mongoid::Document
  include Mongoid::Paperclip

  field :portf_id, type: Integer
  embedded_in :portf , :inverse_of => :images
  has_mongoid_attached_file :file
end

portfolio controller

  # GET /portfs/new
  # GET /portfs/new.json
  def new
    @portf = Portf.new
    5.times { @portf.images.build }

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @portf }
    end
  end

  # GET /portfs/1/edit
  def edit
    @portf = Portf.find(params[:id])
    5.times { @portf.images.build }
  end

form

  <%= form_for @portf, :html => { :multipart => true } do |f| %>
    <%= f.fields_for :images do |image| %>
             <% if image.object.new_record? %>
                   <%= image.file_field :file %>                                  
             <% end %>
   <% 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-10T06:34:59+00:00Added an answer on June 10, 2026 at 6:34 am

    First of all, you need to make the images_attributes available for mass assignment instead of images therefore you have to do

      attr_accessible :images_attributes
    

    You may also want to add :title there as well.

    Furthermore, when you have paperclip attachments in embedded documents you need to add cascade callback. From https://github.com/meskyanichi/mongoid-paperclip :

    Note on embedded documents: if you plan to save or update the parent document, you MUST add cascade_callbacks: true to your embeds_XXX statement. Otherwise, your data will be updated but the paperclip functions will not run to copy/update your file.

    So you need to do:

      embeds_many :images, :cascade_callbacks => true
    

    You can read more on cascading callbacks here: http://mongoid.org/en/mongoid/docs/relations.html#common

    Also – there is a blocker issue with mongoid-paperclip right now https://github.com/meskyanichi/mongoid-paperclip/issues/32 the pull request is there but it has not been merged yet. So you may stumble upon this error if you use it with Mongoid 3.

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

Sidebar

Related Questions

every thing work fine locally but this error occurs when I publish it: The
This has been driving me crazy. I think I have everything in place but
I'm trying to do my initial upload to github. I think I have everything
I've tried nearly everything I can think of, but I'm still running into issues
I have a piece of code that I think should compile, but it doesn't.
Bootstrap's popover works perfectly on my local machine but doesn't seem to work on
I know this is a bit specific, but I've tried everything I could think
i am using formview and sqldatasouce. every thing is fine but when i have
I think everything is in the question. I'm looking for the Lazyboy equivalent for
I'm a complete Codeigniter noob. I think I have everything setup properly, and the

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.