issue with image processing & mini magic gems in rails 7 while creating image variants in active storage

in my rails Application I have the following code.

    class ProjectImage < ApplicationRecord
      belongs_to :project

      has_many_attached :images do |attachable|
        attachable.variant :thumb, resize_to_limit: [100, 100], saver: { quality: 80 }
        attachable.variant :medium, resize_to_limit: [800, 800], saver: { quality: 75 }
      end
    end

and in gemfile

    gem 'image_processing', '~> 1.2'
    gem 'mini_magick'

Iam getting the following errors like below

/home/dinesh/.rvm/gems/[email protected]/gems/image_processing-1.2.0/lib/image_processing/chainable.rb:15:in `saver’: wrong number of arguments (given 1, expected 0) (ArgumentError)

in rails console while trying to create thumnail and medium variants of an attached image

  dinesh@DESKTOP-635K3MC:/mnt/c/Workspace/my_app$ rails c
  No executable found at . Will fall back to
  Loading development environment (Rails 7.0.4)
  3.2.0 :001 > require 'image_processing/mini_magick'
  [METRICS]  Completed in 2.4ms | Allocations: 241
  => true
  3.2.0 :002 > image = ProjectImage.last.images.first
    ProjectImage Load (0.7ms)  SELECT `project_images`.* FROM `project_images` ORDER BY `project_images`.`id` DESC LIMIT 1
    ActiveStorage::Attachment Load (60.4ms)  SELECT `active_storage_attachments`.* FROM `active_storage_attachments` WHERE `active_storage_attachments`.`record_id` = 88 AND `active_storage_attachments`.`record_type` = 'ProjectImage' AND `active_storage_attachments`.`name` = 'images' ORDER BY `active_storage_attachments`.`id` ASC LIMIT 1
  [METRICS]  Completed in 126.8ms | Allocations: 14520 | ActiveRecord: 63.8ms (queries: 6)
  => #<ActiveStorage::Attachment:0x00007ff6cfcfc678 id: 144, name: "images", record_type: "ProjectImage", record_id: 88, blob_id: 144, created_at: Wed, 31 Jul 2024 05:17:10.672157000 EDT -04:00>

  3.2.0 :011 > processed = ImageProcessing::MiniMagick
  3.2.0 :012 > .source(image)
  3.2.0 :013 > .resize_to_limit(800, 800)
  3.2.0 :014 > .quality(75)
  3.2.0 :015 > .call(destination: '/tmp/processed_image.jpg')
  /home/dinesh/.rvm/gems/[email protected]/gems/image_processing-1.2.0/lib/image_processing/chainable.rb:54:in `branch': wrong number of arguments (given 1, expected 0) (ArgumentError)
  3.2.0 :016 >

  3.2.0 :039 >
  3.2.0 :040 > file = ActiveStorage::Blob.service.send(:path_for, image.key)
  [METRICS]  Completed in 0.2ms | Allocations: 59
  => "/mnt/c/Workspace/my_app/storage/dh/en/dhenjruof4jlv35411oxebu9j0tt"
  3.2.0 :041 >
  3.2.0 :042 > processed = ImageProcessing::MiniMagick
  3.2.0 :043 >   .source(file)
  3.2.0 :044 >   .resize_to_limit(800, 800)
  3.2.0 :045 >   .quality(75)
  3.2.0 :046 >   .call(destination: '/tmp/processed_image.jpg')
  /home/dinesh/.rvm/gems/[email protected]/gems/image_processing-1.2.0/lib/image_processing/chainable.rb:54:in `branch': wrong number of arguments (given 1, expected 0) (ArgumentError)
  3.2.0 :047 >

  3.2.0 :047 >
  3.2.0 :048 > include Rails.application.routes.url_helpers
  [METRICS]  Completed in 0.5ms | Allocations: 175
  => Object
  3.2.0 :049 >
  3.2.0 :050 >
  3.2.0 :051 > Rails.application.routes.default_url_options[:host] = 'localhost:3000'
  [METRICS]  Completed in 0.1ms | Allocations: 52
  => "localhost:3000"
  3.2.0 :052 >
  3.2.0 :053 > project_image = ProjectImage.last
    ProjectImage Load (0.4ms)  SELECT `project_images`.* FROM `project_images` ORDER BY `project_images`.`id` DESC LIMIT 1
  [METRICS]  Completed in 1.4ms | Allocations: 217 | ActiveRecord: 0.4ms (queries: 1)
  =>
  #<ProjectImage:0x00007ff6cfbeb7c0
  ...
  3.2.0 :054 > or(image)
  3.2.0 :054 > project_image.images.each do |image|
  3.2.0 :055 >   original_url = url_for(image)
  3.2.0 :056 >   thumbnail_url = url_for(image.variant(:thumb).processed)
  3.2.0 :057 >   medium_url = url_for(image.variant(:medium).processed)
  3.2.0 :058 >
  3.2.0 :059 >   puts "Original: #{original_url}"
  3.2.0 :060 >   puts "Thumbnail: #{thumbnail_url}"
  3.2.0 :061 >   puts "Medium: #{medium_url}"
    ActiveStorage::Attachment Load (0.4ms)  SELECT `active_storage_attachments`.* FROM `active_storage_attachments` WHERE `active_storage_attachments`.`record_id` = 88 AND `active_storage_attachments`.`record_type` = 'ProjectImage' AND `active_storage_attachments`.`name` = 'images'
    ActiveStorage::Blob Load (0.3ms)  SELECT `active_storage_blobs`.* FROM `active_storage_blobs` WHERE `active_storage_blobs`.`id` = 144 LIMIT 1
    ActiveStorage::VariantRecord Load (0.5ms)  SELECT `active_storage_variant_records`.* FROM `active_storage_variant_records` WHERE `active_storage_variant_records`.`blob_id` = 144 AND `active_storage_variant_records`.`variation_digest` = 'ENcXmpHy8uaefOEARzwsAvf/nEc=' LIMIT 1
    Disk Storage (11.1ms) Downloaded file from key: dhenjruof4jlv35411oxebu9j0tt
  /home/dinesh/.rvm/gems/[email protected]/gems/image_processing-1.2.0/lib/image_processing/chainable.rb:15:in `saver': wrong number of arguments (given 1, expected 0) (ArgumentError)
  3.2.0 :063 >
  3.2.0 :064 >

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật