1. Ruby / Говнокод #28860

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    class MoveAchieveTemplateIdentifierToRatePeriodPrograms < ActiveRecord::Migration
      def up
        RatePeriod.find_in_batches(batch_size: 1_000) do |batch|
          sleep(50)
          batch.each do |rate_period|
            achieve_template_identifier = rate_period.achieve_template_identifier
            rate_period.rate_period_programs.update_all(achieve_template_identifier: achieve_template_identifier)
          end
        end
      end
    
      def down
        raise ActiveRecord::IrreversibleMigration
      end
    end

    fml

    Shannarra_, 02 Октября 2023

    Комментарии (0)
  2. Ruby / Говнокод #28073

    0

    1. 1
    http://mainisusuallyafunction.blogspot.com/2014/02/x86-is-turing-complete-with-no-registers.html

    посмотрите в комменты

    kcalbCube, 06 Марта 2022

    Комментарии (4)
  3. Ruby / Говнокод #27327

    +2

    1. 1
    page < records.total_pages ? next_page_exist = true : next_page_exist = false

    очевидное должно быть очевидны

    AlexKlim, 29 Марта 2021

    Комментарии (89)
  4. Ruby / Говнокод #26914

    0

    1. 1
    2. 2
    3. 3
    4. 4
    Отбор = Новый Структура();
    Отбор.Вставить("РабочийДокумент", Работы[0].РабочийДокумент.Ссылка);
    			
    ВсеСтатусыЗаявки = РегистрыСведений.Renault_АвтосервисСтатусыРабот.СрезПоследних().НайтиСтроки(Отбор);

    РегистрыСведений.Renault_АвтосервисСтату сыРабот.СрезПоследних() возвращает окол 200 000 записей и работает около 5 секунд.

    NioGoth, 03 Сентября 2020

    Комментарии (25)
  5. Ruby / Говнокод #26552

    0

    1. 1
    2. 2
    p "Какой багор )))"
    puts "Какой багор )))"

    Какой багор )))

    YxaHbckuu_nemyx, 06 Апреля 2020

    Комментарии (95)
  6. Ruby / Говнокод #26267

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    - @a_parts.each do |part|
                .part.uk-card.uk-card-default.uk-card-hover data-id=part.id
                  - p_image = "/images/no_photo.png"
                  - if part.image
                    - images = part.image.split(',')
                    - p_image = (images[0] == nil) ? "/images/no_photo.png" : "/images/compressed_#{images[0]}"
                    - p_img = (images[0] == nil) ? "/images/no_photo.png" : "/images/#{images[0]}"
                    - p_image = p_img unless File.exists?("#{Rails.root.to_s}/public/images/compressed_#{images[0]}")
                    - if images[0].split('http').length > 1
                      - p_image = images[0]

    Все внимание к 6,7 и 9 строке
    6 и 7 строка позитивное условие тернарного оператора не может случиться
    9 строка - хотя если вдруг случится, то вылетит тут с ошибкой. так как nil нельзя ни split'нуть, ни дальше посчитать длину

    supaweb, 14 Декабря 2019

    Комментарии (9)
  7. Ruby / Говнокод #24717

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    FILE_TYPES_EXTENSIONS.each do |t, e|
          if e.include? extension
            return t
          elsif e.any? {|_e| _e.is_a? Hash}
            if _t = e.reduce({}) { |m, x| m = m.merge(x) if x.is_a?(Hash); m }.find{|_t, _e| _e.include? extension}
              return retrieve_parent ? t : _t.first
            end
          end
        end
        nil

    только создатель поймет, насрал и пропал

    ruby_noname, 04 Сентября 2018

    Комментарии (48)
  8. Ruby / Говнокод #24427

    0

    1. 1
    course = course_id > 0 ? Course.find(course_id) : nil

    стаж - это багаж. Senior

    AlexKlim, 29 Июня 2018

    Комментарии (33)
  9. Ruby / Говнокод #24381

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    def index
      categories = params[:category_ids].present? ?
        params[:category_ids].collect {|id| Category.find id } :
          Category.all
        respond_with(:api, categories)
    end

    когда не знаешь как на это реагировать

    AlexKlim, 13 Июня 2018

    Комментарии (6)
  10. Ruby / Говнокод #23944

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    @requests  = Request.where(instrument_id: 1).where("state_id not in (12,3,5,8,13,15,4)").where(id: current_user.arr_request_services).order(priority_id: :desc, updated_at: :desc, id: :desc) #.page(params[:page]).per_page(20)
            @requests1 = Request.where(instrument_id: 1).where(locked_by: current_user).where("state_id not in (12,3,5,8,13,15,4)").order(priority_id: :desc, updated_at: :desc, id: :desc)
            @requests2 = Request.where(instrument_id: 1).where(author_id: current_user.id).where("state_id not in (12,3,5,8,13,15,4)").order(priority_id: :desc, updated_at: :desc, id: :desc)
            @requests3 = Request.where(instrument_id: 1).where(owner_id: current_user.id).where("state_id not in (12,3,5,8,13,15,4)").order(priority_id: :desc, updated_at: :desc, id: :desc)
            @requests  = (@requests + @requests1 + @requests2 + @requests3).uniq

    Что это ?

    eggshke, 17 Марта 2018

    Комментарии (4)