attachment_fu: saving content in multiple models ?!

Yeah,

I’m trying to solve it:

Models: User and Picture

User has_many Pictures
Pictures belongs_to User

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

<%= f.text_field :anything %>
<%= f.file_field :uploaded_data %>
<% end %>

At Picture.rb:

has_attachment :content_type => :image,
:storage => :file_system,

              :max_size => 2.megabytes,
              :resize_to => "640x480",
              :path_prefix => 'public/images/'

validates_as_attachment

I tried to do something like:

@user = User.new
params[:user].each do |p|
  unless p == ':uploaded_data' # it's really an idea!
    @user = User.update_attributtes(:name, p)
  else
    @user = User.picture_id.update_attributte(:name, p)

  end
end

This sounds me very bad because it isn’t DRY.

How can i save the ‘:anything’ object in User model and ‘:uploaded_data’ object to User.picture_id or Picture passing the user_id ?

Thanks for your attention!