This may be a basic question, but i have an "image" field in a
"news"
table, and have a form that uploads the image. Following the upload,
the "new" action is called in the rails scaffolding so i can add the
rest of the news to db entry. I however want the "image" field to
contain the image "id" that was just created in my image table. I send
the value to the new action, but cannot get the field to default to
this value. As i am fairly unfamiliar with where the scaffolding is
storing the information for this form I am having trouble figuring
this out. I am unable to find the _form teplate as is described in
pickaxe as a partial. Here is the code for the view. The second form
is the form I am using to upload the image. So my question is how do i
get the image field to use a default value that was passed to the view
rather than what is stored as default in my db.
<h1>New news</h1>
<%= start_form_tag :action => ''create'' %>
<%= render :partial => ''form''%>
<%= submit_tag "Create" %>
<%= end_form_tag %>
<%= form_tag({:action=>''save_picture''}, :multipart =>
true)%>
<input type="file" name="picture_file" />
<input type="submit" name="Upload" />
</form>
<%= link_to ''Back'', :action => ''list''
%>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---