Sha256: cc83f1dd502e6ad72a6c3c999a6801c7859fd0416ae1c824b8894b726b8b171d
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
class CloudhdrController < ApplicationController protect_from_forgery :except=>[:cloudhdr_notification_update,:zencoder_notification_update,:thumbnail_update,:multi_thumbnail_update] def cloudhdr_notification_update full_params = params puts "cloudhdr_notification_update" puts params CloudhdrJob.update_from_cloudhdr(full_params) respond_to do |format| format.json { render :json => {} } end end def thumbnail_update @img = Kernel.const_get(params[:class]).find params[:id] @random = params[:random] @live_vide = params[:live_video] respond_to do |format| format.js {} end end def multi_thumbnail_update @outputs = [] params[:images].each do |image| # Format ex : Image_1_medium_db0ce8ba5d55c25eee7c767220d654fe # Format is : class_id_thumbnail_random match = image.match(/^(.*)_(.*)_(.*)_(.*)$/) hash = { :elem_id => image, :class_name => match[1], :id => match[2], :thumbnail => match[3], :random => match[4], :image => Kernel.const_get(match[1]).find(match[2]) } @outputs << hash end respond_to do |format| format.json {} end end # thanks to http://avdi.org/devblog/2009/07/14/recursively-symbolize-keys/ #def symbolize_keys(hash) #puts "the hash = #{hash.class} : #{hash}" #return hash if !hash.is_a?(Hash) #hash.inject({}){|result, (key, value)| #new_key = case key #when String then key.to_sym #else key #end #new_value = case value #when Hash then symbolize_keys(value) #else value #end #result[new_key] = new_value #result #} #end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cloudhdr_rails-0.0.11 | app/controllers/cloudhdr_controller.rb |