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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:47:29+00:00 2026-05-13T19:47:29+00:00

Woo. My first question. I have a feeling I’m overlooking something pretty basic in

  • 0

Woo. My first question.

I have a feeling I’m overlooking something pretty basic in the construction of my form. I’m using attachment_fu and can’t get this form to pass anything besides the file data. A user has_many profiles and a profile has_many documents.

My form looks like this:

<%= error_messages_for :document %>

<% form_for([@user, @profile, @document], :html => {:multipart => true }) do |f| -%>
  <p>
    <label for="document">Upload A document:</label>
    <%= f.file_field :uploaded_data %>
  </p>
 <%= f.label :description%>
 <%= f.text_field :description%>
  <p>
    <%= submit_tag 'Upload' %>
  </p>
<% end -%>

And here’s the controller:

  before_filter :require_user, :get_profile

  def new
    @document = @profile.documents.build
  end

  def create
    @document = @profile.documents.build(params[:document])

    if @document.save
      flash[:notice] = 'Your document was successfully created.'
      redirect_to document_url(@document)     
    else
      render :action => :new
    end
  end

  private

  def get_profile
    @user = current_user
    @profile = @user.profiles.find(params[:profile_id])
  end

The logs show all the image data getting posted, but I cannot pass the description or, more importantly, the profile_id, which is the foreign key in my document model. I was stuck on this all night, and can’t think of anything fresh this morning. Any help would be great.

  • 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-13T19:47:29+00:00Added an answer on May 13, 2026 at 7:47 pm

    For the profile_id you will need something like:

    <%= f.hidden_field :profile_id %>
    

    Which in your controller you will get at using params[:document][:profile_id] if needed.
    Although from trying to guess at what your code is doing, I suspect that params[:profile_id] is already set from whatever route got you to this controller.

    I am not sure why you aren’t seeing anything for the description. It should be coming into your controller as params[:document][:description].

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

Sidebar

Ask A Question

Stats

  • Questions 350k
  • Answers 351k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As you point out they're all part of the same… May 14, 2026 at 7:10 am
  • Editorial Team
    Editorial Team added an answer The SQLBulkCopy class in .net can blast records in pretty… May 14, 2026 at 7:10 am
  • Editorial Team
    Editorial Team added an answer How about something like DECLARE @Table TABLE( Name VARCHAR(10) )… May 14, 2026 at 7:10 am

Related Questions

First time reader, first time poster (woo!) So I've been implementing my login scripts
In my small app for Mac OS X I display some info in system
I'm trying to use XPath to parse an XML document. One of my NSXMLElement's
Hopefully an easy one, I have created a Custom Repeater control that extends System.Web.UI.WebControls.Repeater.
I have a tag like this <order>foo,bar,goo,doo,woo</order> that I need to validate with an

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.