Report abuse


			
#forgive me, this just isn't clear to me (yet)...

# here is [part of] my project's SHOW view:


<% form_for @image, :html => { :multipart => true } do |f| %>
  

Upload Image
<%= f.file_field :image_file %>
or URL: <%= f.text_field :image_file_url %> <%- if @image.new_record? -%> <%= f.hidden_field :project_id %> <%- end -%>

<%= f.submit "Upload Image" %>

<% end %> # here is the project controller's show action: def show @project = Project.find(params[:id]) @image = @project.images.build if params[:image_id] @myimage = @project.images.find_by_id(params[:image_id]) end respond_to do |format| format.html # show.html.erb format.xml { render :xml => @project } end end # here is the Image controller's create action: def create @project = Project.find(params[:project_id]) @image = @project.images.build(params[:image]) if @image.save redirect_to image_url(@image) else flash[:notice] = 'Your image did not pass validation!' render :action => 'new' end end