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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:16:39+00:00 2026-06-10T18:16:39+00:00

Here is the log from a successful 1 image upload: Started POST /kampagners for

  • 0

Here is the log from a successful 1 image upload:

Started POST "/kampagners" for 127.0.0.1 at 2012-09-01 20:18:01 +0000
Processing by KampagnersController#create as HTML
  Parameters: {"utf8"=>"V", "authenticity_token"=>"84w29N5okGI8BcL1cMc53fQzcVRAb
UTN/jssk6MI3qM=", "kampagner"=>{"titel"=>"lp", "landing_page"=>"lp", "kampagne_b
eskriv"=>"lp", "kampagne_maal"=>"l", "t1"=>"pl", "t2"=>"pll", "t3"=>"pl", "t4"=>
"p", "t5"=>"lp", "photos_attributes"=>{"photo"=>{"image"=>#<ActionDispatch::Http
::UploadedFile:0x38b5408 @original_filename="Skemaweb.PNG", @content_type="image
/png", @headers="Content-Disposition: form-data; name=\"kampagner[photos_attribu
tes][photo][image]\"; filename=\"Skemaweb.PNG\"\r\nContent-Type: image/png\r\n",
 @tempfile=#<File:C:/Users/AppData/Local/Temp/RackMultipart20120901-455
6-1d2qq7z>>}}, "ppc"=>"1", "soc"=>"1", "email"=>"1", "cashback"=>"0", "budget"=>
"12", "prisklik"=>"12"}, "commit"=>"Opret konkurrence"}
  ←[1m←[36m (18.0ms)←[0m  ←[1mBEGIN←[0m
  ←[1m←[35mSQL (0.0ms)←[0m  INSERT INTO `kampagners` (`budget`, `cashback`, `cli
cks`, `email`, `kampagne_beskriv`, `kampagne_maal`, `landing_page`, `ppc`, `pris
klik`, `soc`, `t1`, `t2`, `t3`, `t4`, `t5`, `titel`) VALUES (12, 0, 0, 1, 'lp',
'l', 'lp', 1, 12, 1, 'pl', 'pll', 'pl', 'p', 'lp', 'lp')
  ←[1m←[36mSQL (0.0ms)←[0m  ←[1mINSERT INTO `photos` (`image_content_type`, `ima
ge_file_name`, `image_file_size`, `image_remote_url`, `image_updated_at`, `kampa
gner_id`, `str`) VALUES ('image/png', 'Skemaweb.PNG', 114875, NULL, '2012-09-01
20:18:03', 39, NULL)←[0m
[paperclip] Saving attachments.
  ←[1m←[35m (2.0ms)←[0m  COMMIT

Here are am uploading 2 images, but without succes:

Started POST "/kampagners" for 127.0.0.1 at 2012-09-01 20:19:03 +0000
Processing by KampagnersController#create as HTML
  Parameters: {"utf8"=>"V", "authenticity_token"=>"84w29N5okGI8BcL1cMc53fQzcVRAb
UTN/jssk6MI3qM=", "kampagner"=>{"titel"=>"lpl", "landing_page"=>"lp", "kampagne_
beskriv"=>"lp", "kampagne_maal"=>"lp", "t1"=>"llp", "t2"=>"lp", "t3"=>"l", "t4"=
>"pl", "t5"=>"lp", "photos_attributes"=>{"0"=>{"photo"=>{"image"=>#<ActionDispat
ch::Http::UploadedFile:0x690480 @original_filename="Skemaweb.PNG", @content_type
="image/png", @headers="Content-Disposition: form-data; name=\"kampagner[photos_
attributes][0][photo][image]\"; filename=\"Skemaweb.PNG\"\r\nContent-Type: image
/png\r\n", @tempfile=#<File:C:/Users/AppData/Local/Temp/RackMultipart20
120901-4556-1dcutiv>>}}, "1"=>{"photo"=>{"image"=>#<ActionDispatch::Http::Upload
edFile:0x694ba8 @original_filename="Skemaweb.PNG", @content_type="image/png", @h
eaders="Content-Disposition: form-data; name=\"kampagner[photos_attributes][1][p
hoto][image]\"; filename=\"Skemaweb.PNG\"\r\nContent-Type: image/png\r\n", @temp
file=#<File:C:/Users/Niceberg/AppData/Local/Temp/RackMultipart20120901-4556-t0dd
md>>}}}, "ppc"=>"1", "soc"=>"1", "email"=>"1", "cashback"=>"0", "budget"=>"21",
"prisklik"=>"23"}, "commit"=>"Opret konkurrence"}
  ←[1m←[35m (0.0ms)←[0m  BEGIN
  ←[1m←[36mSQL (1.0ms)←[0m  ←[1mINSERT INTO `kampagners` (`budget`, `cashback`,
`clicks`, `email`, `kampagne_beskriv`, `kampagne_maal`, `landing_page`, `ppc`, `
prisklik`, `soc`, `t1`, `t2`, `t3`, `t4`, `t5`, `titel`) VALUES (21, 0, 0, 1, 'l
p', 'lp', 'lp', 1, 23, 1, 'llp', 'lp', 'l', 'pl', 'lp', 'lpl')←[0m
  ←[1m←[35mSQL (0.0ms)←[0m  INSERT INTO `photos` (`image_content_type`, `image_f
ile_name`, `image_file_size`, `image_remote_url`, `image_updated_at`, `kampagner
_id`, `str`) VALUES (NULL, NULL, NULL, NULL, NULL, 40, NULL)
[paperclip] Saving attachments.
  ←[1m←[36mSQL (0.0ms)←[0m  ←[1mINSERT INTO `photos` (`image_content_type`, `ima
ge_file_name`, `image_file_size`, `image_remote_url`, `image_updated_at`, `kampa
gner_id`, `str`) VALUES (NULL, NULL, NULL, NULL, NULL, 40, NULL)←[0m
[paperclip] Saving attachments.
  ←[1m←[35m (1.0ms)←[0m  COMMIT
Redirected to

My nested form:

 <%= f.simple_fields_for :photos do |build| %>
   <%= render "billeder", :build => build %>
<% end %>

and _billeder:

<%= build.simple_fields_for :photo do |d| %>
    <%= d.file_field :image, :label => 'Image', :style => 'margin-bottom:2px;float:left;width:250px;'  %>
<% end %>

What can be the reason for the images are not uploaded? They are created with the values NULL NULL and NULL.

UPDATE:

Controller code kampagners:

def new
    @kampagner = Kampagner.new
    2.times {@kampagner.photos.build }
    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @kampagner }
    end
  end

  def create
    @kampagner = Kampagner.new(params[:kampagner])
    respond_to do |format|
      if @kampagner.save
        format.html { redirect_to(:kampagners, :notice => 'Kampagner was successfully created.') }
      else
        format.html { render :action => "new" }
      end
    end
  end

The Kampagner model:

  class Kampagner < ActiveRecord::Base
    has_many :photos
    accepts_nested_attributes_for :photos
    attr_accessible :titel, :budget, :photos_attributes, :ppc, :sem, :soc, :cashback,
                    :landing_page, :budget, :prisklik, :t1, :t2, :t3, :t4, :t5,
                    :kampagne_beskriv, :kampagne_maal, :email, :image_url, :billed_navn, :photos, :image, :photo
    end

The Photo model:

 require 'open-uri'
    class Photo < ActiveRecord::Base
      belongs_to :kampagner
      attr_accessor :image_url, :billed_navn, :photo
      #sadasdasas
      Paperclip.options[:command_path] = "/usr/local/bin"
      has_attached_file :image,
              :path => ':rails_root/public/images/ads/:id/:basename.:extension',
              :url  => "images/ads/:id/:basename.:extension"
     attr_accessible :photos_attributes, :image_url, :billed_navn, :photo, :image, :kampagner_id, :image_remote_url, :image_file_name, :image_content_type, :image_file_size, :image_updated_at, :str
    end

The form:

<%= simple_form_for @kampagner, :html => { :multipart => true, :class => 'newform', :style => 'width:100%;' } do |f| %>
<h1 style="margin-top:10px;padding-top:0px;font-size:12px;">Tilføj billeder</h1>
 <%= f.simple_fields_for :photos do |build| %>
   <%= render "billeder", :build => build %>
<% end %>
<%= f.submit "Opret kampagne", :style => "margin-bottom:20px;" %>
<% 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-10T18:16:41+00:00Added an answer on June 10, 2026 at 6:16 pm

    It looks like the desired params should appear without the extra layer of photo, like:

    "photos_attributes"=>{"0"=>{"image"=>#<ActionDispat
    ch::Http::UploadedFile:0x690480 @original_filename="Skemaweb.PNG", @content_type
    ="image/png", @headers="Content-Disposition: form-data; name=\"kampagner[photos_
    attributes][0][image]\";
    

    It worked for the single attachment case because the params was already in the desired format — the photo key in photos_attributes"=>{"photo"=>{"image"
    could have been been some other identifier like 0, but it was its value (starting from {"image"}) that is important.

    Edit: (corrected mistake)

    So, replace your <%= f.simple_fields_for :photo ... block in your _billeder partial with just the following:

       <%= build.file_field :image, :label => 'Image', :style => 'margin-bottom:2px;float:left;width:250px;'  %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://logging.apache.org/log4net/release/config-examples.html Given the log table here: CREATE TABLE [dbo].[Log] ( [Id] [int] IDENTITY (1,
Here's my biopsis Works : :plain console.log(#{escape_javascript(render(@job_charge).html_safe)}); Does not work ( but should? )
Here is the situation: I am making a small prog to parse server log
Here is my jquery code: $('input').click(function(){ $('h1').empty().queue(function(){ console.log('queue'); }); }); }); Only the first
I am trying to log into facebook here is my code: <body> <form id=form1
Here is my code: var showNo = 1; window.setInterval(function() { console.log(showNo); if(showNo === 1)
Here's my tiny script to run celeryd: #!/bin/bash -x LOG=/home/var/log/ingest.log sudo -u apache bash
Here's the situation. function scrollLog(line) { // Assume Firefox // alert(weird); frames['log'].find(line); }; Here's
I have a bunch of log files which are pure text. Here is an
What's going on here? BTW, MySQL Server version: 5.0.45-log Source distribution. mysql> select count(*)

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.