<commit_before>class AssetsController < ApplicationController
  before_filter :signed_in_user
  before_filter :admin_user, only: [:edit, :update]
  
  def create
    @asset = current_user.assets.build(params[:asset])
    if @asset.save
      redirect_to root_path
      flash.now[:success] = "Asset created!"
    else
      render 'static_pages/home'
    end
  end
  
  def show
    @asset = Asset.find(params[:id])
    respond_to do |format|
      format.html
      format.pdf do
        @asset_pdf  = Asset.find(params[:id])
        pdf = AssetPdf.new(@asset_pdf)
        send_data pdf.render, filename: "asset_#{@asset_pdf.id}.pdf",
                                        type: "application/pdf",
                                        disposition: "inline"
      end
    end
  end
  
  def edit
    @asset = Asset.find(params[:id])
  end
  
  def update
    @asset = Asset.find(params[:id])
    if @asset.update_attributes(params[:asset])
      flash[:notice] = "Profile updated"
      redirect_to assets_path
    else
      render 'edit'<commit_msg>made a correction to the redirect on asset update now that there is a proper show page for each asset<commit_after>class AssetsController < ApplicationController
  before_filter :signed_in_user
  before_filter :admin_user, only: [:edit, :update]
  
  def create
    @asset = current_user.assets.build(params[:asset])
    if @asset.save
      redirect_to root_path
      flash.now[:success] = "Asset created!"
    else
      render 'static_pages/home'
    end
  end
  
  def show
    @asset = Asset.find(params[:id])
    respond_to do |format|
      format.html
      format.pdf do
        @asset_pdf  = Asset.find(params[:id])
        pdf = AssetPdf.new(@asset_pdf)
        send_data pdf.render, filename: "asset_#{@asset_pdf.id}.pdf",
                                        type: "application/pdf",
                                        disposition: "inline"
      end
    end
  end
  
  def edit
    @asset = Asset.find(params[:id])
  end
  
  def update
    @asset = Asset.find(params[:id])
    if @asset.update_attributes(params[:asset])
      flash[:notice] = "Profile updated"
      redirect_to @asset
    else
      render 'edit'
{'fraction_non_alphanumeric': 0.10159453302961276, 'fraction_numerical': 0.0, 'mean_word_length': 2.2485207100591715, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7571533', 'n_tokens_mistral': 659, 'n_tokens_neox': 648, 'n_words': 158}