Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Migrate image to new model.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Brian Bokor  
View profile  
 More options Apr 20 2012, 5:12 pm
From: Brian Bokor <brian.bo...@shelterexchange.org>
Date: Fri, 20 Apr 2012 14:12:40 -0700 (PDT)
Local: Fri, Apr 20 2012 5:12 pm
Subject: Migrate image to new model.

I have been able to migrate my images to the new model but it keeps the old
image around.  I think I'm doing this incorrect.

I have a Photo Model and ImageUploader with Fog (have also tried the
remote_image_url method

I wanted to migrate my old images to the Photo Model and would rather just
set the image field with the filename then reprocess later, but it won't
let me do this since it is serialized to the Uploader.  Any suggestions

Would be ideal but doesn't work
photo = Photo.new(:attachable =>old_model)
photo.image = "test.jpg"
photo.save!

Works but doesn't delete old files
photo = Photo.new(:attachable => old_model)
photo.remote_image_url = "http://test.com/test.jpg"
photo.image.recreate_versions!
photo.save!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brian Bokor  
View profile  
 More options Apr 26 2012, 11:09 am
From: Brian Bokor <brian.bo...@shelterexchange.org>
Date: Thu, 26 Apr 2012 08:09:37 -0700 (PDT)
Local: Thurs, Apr 26 2012 11:09 am
Subject: Re: Migrate image to new model.

This works!      

      photo = Photo.create(:attachable => old_model, :order => 1)
      photo.write_uploader(:image, old_model.photo)
      photo.save!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Damian M. R.  
View profile  
 More options Jul 23 2012, 12:22 pm
From: "Damian M. R." <dam...@gmail.com>
Date: Mon, 23 Jul 2012 09:22:24 -0700 (PDT)
Local: Mon, Jul 23 2012 12:22 pm
Subject: Re: Migrate image to new model.

This didn't work for me, but I found this way that totally worked for me:

new_model.image = old_model.image.file
new_model.save


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »