<commit_before>class Manage::AssetsController < Manage::BaseController
  before_filter :find_klass, :only => [:create]
  before_filter :find_asset, :only => [:destroy]
  
  respond_to :html, :xml
  
  # POST /manage/assets
  def create
    @asset ||= @klass.new(params[:asset])
    
  	@asset.assetable_type = params[:assetable_type]
		@asset.assetable_id = params[:assetable_id] || 0
		@asset.guid = params[:guid]
  	@asset.data = params[:data_file]
  	@asset.user = current_user
    @asset.save
    
    respond_with(@asset)
  end
  
  # DELETE /manage/assets/1
  def destroy
    @asset.destroy
    
    respond_with(@asset) do |format|
      format.html { head :ok }
    end
  end
  
  protected
  
    def find_asset
      @asset = Asset.find(params[:id])  
    end
    
    def find_klass
      c_names = []
      c_values = []
      
      unless params[:assetable_id].blank?
        c_names << "assetable_id = ?"
        c_values << params[:assetable_id].to_i
        
        c_names << "assetable_type = ?"
        c_values << params[:assetable_type]
      else<commit_msg>Fix asset respont_to with swfupload<commit_after>class Manage::AssetsController < Manage::BaseController
  before_filter :find_klass, :only => [:create]
  before_filter :find_asset, :only => [:destroy]
  
  respond_to :html, :xml
  
  # POST /manage/assets
  def create
    @asset ||= @klass.new(params[:asset])
    
  	@asset.assetable_type = params[:assetable_type]
		@asset.assetable_id = params[:assetable_id] || 0
		@asset.guid = params[:guid]
  	@asset.data = params[:data_file]
  	@asset.user = current_user
    @asset.save
    
    respond_with(@asset) do |format|
      format.html { head :ok }
      format.xml { render :xml => @asset.to_xml }
    end
  end
  
  # DELETE /manage/assets/1
  def destroy
    @asset.destroy
    
    respond_with(@asset) do |format|
      format.html { head :ok }
    end
  end
  
  protected
  
    def find_asset
      @asset = Asset.find(params[:id])  
    end
    
    def find_klass
      c_names = []
      c_values = []
      
      unless params[:assetable_id].blank?
        c_names << "assetable_id = ?"
        c_values << params[:assetable_id].to_i
        
        c_names << "assetable_type = ?"
        c_values << params[:assetable_type]
      else
{'fraction_non_alphanumeric': 0.1215566243987757, 'fraction_numerical': 0.0017490161783996502, 'mean_word_length': 2.5694227769110762, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1204091', 'n_tokens_mistral': 800, 'n_tokens_neox': 787, 'n_words': 149}