My models:

class Country < ActiveRecord::Base
  has_many :regions
  has_many :assets, :dependent => :destroy
  accepts_nested_attributes_for :assets
end


class Region < ActiveRecord::Base
  belongs_to :country
  has_many :appartments

  has_many :assets, :dependent => :destroy
  accepts_nested_attributes_for :assets
end


class Asset < ActiveRecord::Base
  belongs_to :region
  belongs_to :country
  has_attached_file :image,
    :styles => {
      :thumb=> "100x100>",
      :small  => "300x300>",
      :large => "600x600>"
  }
end


The region _form

<% form_for([@country, @region])  do |f| %>
    <%= f.label :title %><br />
    <%= f.text_field :title %>
    <%= f.label :content %><br />
    <%= f.text_area :content %>
<%= f.fields_for :assets do |asset| %>
           <% if asset.object.new_record? %>
                 <%= asset.file_field :image %>

controller:
 @country = Country.find(params[:country_id])
 @region = @country.regions.find(params[:id])
  5.times { @region.assets.build }

When uploading an image only the region_id is filled in and not the
paperclip attributes.

What i am doing wrong?

Grtz..remco

-- 
Posted via http://www.ruby-forum.com/.

-- 
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