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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:54:44+00:00 2026-06-02T08:54:44+00:00

iam using rails with formtastic for my admin backend. i want to be able

  • 0

iam using rails with formtastic for my admin backend. i want to be able to upload an image to my recordset, and i try to use paperclip to to that.

when i edit a recordset, the upload of the image works just fine. when i try to CREATE a NEW recordset, paperclip seems to assign the ID 0 for that image in my upload path!

#expected path for new image:
/public/logos/2342/some_image.png


#and thats what i get when i create my new record-set:
/public/logos/0/some_image.png

i tried to add attr_accessible to my model

attr_accessible :logo_file_name, :logo_content_type, :logo_file_size, :logo_updated_at

but that throws me an sql-error

Column ‘logo_file_size’ cannot be null

EDIT: solved the mysql error when i add attr_accessible. i just allowed the logo_file_size to be null. but the id=0 problem still exists…

my code:

MODEL:

has_attached_file :logo, 
              :url => "/:class/:attachment/:id/:basename.:extension", 
              :styles => { :original => ["150x150>", :png] }

VIEW:

<%= f.inputs do %>
    <%= f.input :name %>
    <%= f.input :logo, :as => :file %>
    <%= f.input :link, :as => :url %>
    <%= f.input :published, :published => 'Veröffentlicht' %>
<% end %>

CONTROLLER:

def create
  Article.create(params[:article])
end

my datebase has these 4 colums in Article-Table:
logo_file_name
logo_content_type
logo_file_size
logo_updated_at

iam using rails 3.1.1, formtastic 1.2.4, paperclip 2.4.5

thanks a lot for your help!!!

  • 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-02T08:54:45+00:00Added an answer on June 2, 2026 at 8:54 am

    i know its a bit late, but i found the problem and will share the answer for everyone with the same problem.

    problem was mysql, upgraded to mysql2 gem, and everything worked as expected

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

Sidebar

Related Questions

I am using rails 3.1rc4 with paperclip and i cannot upload any image file
I am using Rails 3.1, it seems that I could not use Ruby script
I am using Rails 3.2.1. Is it possible to use different views when using
I am using bootstrap-sass, formtastic-bootstrap, rails 3.2, and ruby 1.9.3p0 on a new project.
I am using rails 3.2 and devise 1.5.3. I added an admin attribute in
I have the following in a partial in a Rails 3.2 app using formtastic
I am using Rails 3.0.8 Lets say that I have two collections of users.
I am using Rails 3.2, I have a form and I want it to
Iam using Rails 3.0 and Devise. I am trying to figure out the best
I am using Rails 3 and getting an error that looks like this: undefined

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.