Good night, Could anyone tell me how can I split this hash? {"title"=>"sssssssss", "avatar"=>#<ActionDispatch::Http::UploadedFile:0x007fefd1104a28 @tempfile=#<Tempfile:/var/folders/_6/h2yz29bx1cs_swwr5vx6rl4r0000gn/T/RackMultipart20140424-10615-nfz0ta>, @original_filename="alf.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"photo[avatar]\"; filename=\"alf.jpg\"\r\nContent-Type: image/jpeg\r\n">} I need to create a new Photo objet with that data. I can't use the normal way *'Photo.create(photo_params)'* because I need to add the *user.id* to the photos table. Below is the code that I'm using, but only the fields "title" and "user.id" are being saved in the table of each photo. @photo = Photo.create do |p| p.title = photo_params[:title] p.user_id = current_user.id print p.avatar_file_name = photo_params{attr_accessor :original_filename} p.avatar_content_type = photo_params[:content_type] p.avatar_file_size = photo_params[:avatar_file_size] end Thanks & Regards Alfredo. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7e7ff13f-795a-472c-87f7-0cf4bc362731%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.