File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed
Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ class Media < ActiveRecord::Base
3434 } ,
3535 :processors => [ :thumbnail , :paperclip_optimizer ] ,
3636 :preserve_files => 'true' ,
37- :path => ':class/:attachment/:style-:id.:extension'
37+ # :path => ':class/:attachment/:style-:id.:extension'
38+ :path => ':class/:attachment/careerbuilder-:style-:id.:extension'
3839
3940 validates_attachment :attachment ,
4041 :presence => true ,
Original file line number Diff line number Diff line change 1+
12{
23 "name" : " cortex" ,
34 "authors" : [
4748 "angular" : " 1.2.29"
4849 }
4950}
51+
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ namespace :cortex do
8585 next
8686 end
8787
88+
8889 # Replace text in Snippets and in Posts
8990 puts "Searching for Snippets with the text '#{ find } ' in tenant #{ tenant } "
9091 matching_snippets = Snippet . find_by_tenant_id ( tenant ) . find_by_body_text ( find )
@@ -232,11 +233,16 @@ namespace :cortex do
232233 namespace :media do
233234 desc 'Manage Cortex media'
234235 task :update_url => :environment do
236+
237+ old_url = ENV [ 'OLD_PATH' ]
238+ unless old_url
239+ puts 'OLD_PATH must be set'
240+ end
241+
242+
235243 Media . find_each do |media |
236244 unless media . attachment_file_name . blank?
237- object_id = "%05d" % media . id
238- object_key = "media/attachments/00#{ object_id . first } /00#{ object_id [ 1 ] } /#{ object_id [ 2 ..4 ] } /original/#{ media . attachment_file_name } "
239- puts object_key
245+ object_key = media . attachment . arbitrary_url_for old_url
240246
241247 s3 = Aws ::S3 ::Client . new
242248
Original file line number Diff line number Diff line change 1+ bundle exec rake spec:javascript
You can’t perform that action at this time.
0 commit comments