<commit_before>module Breeze
  module Admin
    module Commerce
      class ShippingMethodsController < Breeze::Admin::Commerce::Controller
        def index
          @shipping_methods = Breeze::Commerce::ShippingMethod.unarchived.where(:store_id => store.id).order_by(:created_at.desc).paginate(:page => params[:page], :per_page => 15)
        end
        
        def new
          @shipping_method = Breeze::Commerce::ShippingMethod.new
          @shipping_method_types = Breeze::Commerce::ShippingMethod.types
        end
        
        def create
          sanitize_input params[:shipping_method]
          if params[:shipping_method_type]
            klass = params[:shipping_method_type].camelcase.constantize
            if klass == Breeze::Commerce::ShippingMethod
              @shipping_method = Breeze::Commerce::ShippingMethod.build params[:shipping_method]
            else
              subclass_params = params[:shipping_method_type].to_s.camelcase.demodulize.underscore
              @shipping_method = klass.new params[:shipping_method].merge params[subclass_params]
            end
          else
            @shipping_method = Breeze::Commerce::ShippingMethod.build params[:shipping_method]
          end
          if @shipping_method.save
            # Set up variables. The view will handle validation.
            @shipping_methods = Breeze::Commerce::ShippingMethod.unarchived.where(:store_id => store.id).order_by(:created_at.desc).paginate(:page => params[:page], :per_page => 15)
            @shipping_method_count = Breeze::Commerce::ShippingMethod.unarchived.count
          else
            @shipping_method_types = Breeze::Commerce::ShippingMethod.types
          end
          # if @shipping_method.save
          #   redirect_to admin_store_shipping_methods_path
          # else
          #   @shipping_method_types = Breeze::Commerce::ShippingMethod.types
          #   render :action => "new"
          # end<commit_msg>Removed store reference from ShippingMethodsController Set position for new shipping methods<commit_after>module Breeze
  module Admin
    module Commerce
      class ShippingMethodsController < Breeze::Admin::Commerce::Controller
        def index
          @shipping_methods = Breeze::Commerce::ShippingMethod.unarchived.order_by(:created_at.desc).paginate(:page => params[:page], :per_page => 15)
        end
        
        def new
          @shipping_method = Breeze::Commerce::ShippingMethod.new
          @shipping_method_types = Breeze::Commerce::ShippingMethod.types
        end
        
        def create
          sanitize_input params[:shipping_method]
          if params[:shipping_method_type]
            klass = params[:shipping_method_type].camelcase.constantize
            if klass == Breeze::Commerce::ShippingMethod
              @shipping_method = Breeze::Commerce::ShippingMethod.new params[:shipping_method]
            else
              subclass_params = params[:shipping_method_type].to_s.camelcase.demodulize.underscore
              @shipping_method = klass.new params[:shipping_method].merge params[subclass_params]
            end
          else
            @shipping_method = Breeze::Commerce::ShippingMethod.new params[:shipping_method]
          end

          @shipping_method.position = Breeze::Commerce::ShippingMethod.count

          if @shipping_method.save
            # Set up variables. The view will handle validation.
            @shipping_methods = Breeze::Commerce::ShippingMethod.unarchived.where(:store_id => store.id).order_by(:created_at.desc).paginate(:page => params[:page], :per_page => 15)
            @shipping_method_count = Breeze::Commerce::ShippingMethod.unarchived.count
          else
            @shipping_method_types = Breeze::Commerce::ShippingMethod.types
          end
          # if @shipping_method.save
          #   redirect_to admin_store_shipping_methods_path
          # else
          #   @shipping_method_types = Breeze::Commerce::ShippingMethod.types
          #   render :action => "new"
          # end
{'fraction_non_alphanumeric': 0.09077417759089784, 'fraction_numerical': 0.001978728666831561, 'mean_word_length': 2.7306273062730626, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '258741', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1131, 'n_words': 180}