> Maybe you just omitted this, but I think your CoverImage should declare
> belongs_to :product
>
Thanks for the idea Craig.  Thought we were on to something there for
a second but apparently not.

The update seems to work just not the create.  If I change the create
method to this: (yes I changed my image class and relationship names)

  def create
    params[:product][:image] = ProductImage.new(params[:product]
[:image])
    @product = Product.new(params[:product])

    respond_to do |format|
      if @product.save
        flash[:notice] = 'Product was successfully created.'
        format.html { redirect_to(admin_products_path) }
        format.xml  { render :xml => @product, :status
=> :created, :location => @product }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @product.errors, :status
=> :unprocessable_entity }
      end
    end
  end

it works fine and the update works as expected with a standard REST
action.

I also noticed that if I change the image relationship to has_many the
form fields aren't getting indexed so I end up with this:
<input id="product_image_uploaded_data" name="product[image]
[uploaded_data]" size="30" type="file" />

instead of this:
<input id="product_image_0_uploaded_data" name="product[image][0]
[uploaded_data]" size="30" type="file" />
etc...

I dunno seems like there must be something really fundamental that I'm
missing.

Help:-)!
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to