Class: Facebooker::Rails::Utilities

Inherits:
Object
  • Object
show all
Defined in:
lib/facebooker/rails/utilities.rb

Class Method Summary collapse

Class Method Details

.refresh_all_images(session) ⇒ Object



5
6
7
8
9
# File 'lib/facebooker/rails/utilities.rb', line 5

def refresh_all_images(session)
  Dir.glob(File.join(RAILS_ROOT,"public","images","*.{png,jpg,gif}")).each do |img|
    refresh_image(session,img)
  end
end

.refresh_image(session, full_path) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/facebooker/rails/utilities.rb', line 11

def refresh_image(session,full_path)
  basename=File.basename(full_path)
  base_path=ActionController::Base.asset_host
  base_path += "/" unless base_path.ends_with?("/")
  image_path=base_path+"images/#{basename}"
  puts "refreshing: #{image_path}"
  session.server_cache.refresh_img_src(image_path)
end