[英]Sweet Alert 2 is not working properly in Rails 7 Application
我試圖將用於自定義標准警報框的Sweet Alert 2 java 腳本庫集成到 Rails 7 應用程序中,但收到以下錯誤消息:“Swal 未定義。” 我正在使用 Ruby 3 和 Rails 7。 我最初嘗試在我的 Rails 應用程序中使用“ sweet-alert2-rails ”gem,但 ...
[英]Sweet Alert 2 is not working properly in Rails 7 Application
我試圖將用於自定義標准警報框的Sweet Alert 2 java 腳本庫集成到 Rails 7 應用程序中,但收到以下錯誤消息:“Swal 未定義。” 我正在使用 Ruby 3 和 Rails 7。 我最初嘗試在我的 Rails 應用程序中使用“ sweet-alert2-rails ”gem,但 ...
[英]Ruby 3.0.4 with Postgres 14 throws segmentation fault
我有 這是我的 database.yml 文件 當我運行 rake db:create 我得到以下 segmentatin 錯誤 ruby 3.0.4p208(2022-04-12 修訂版 3fa771dded)[x86_64-linux] 連接失敗。 我已驗證 postgres 正在運行並且位於 ...
[英]rbenv and Apple m1. Failed installing ruby 3.2, 2.7 and 2.6
我無法使用 rbenv 安裝任何 ruby 版本。 我試過 2.6.10 2.7.7 或 3.2.0。 這是我在執行時得到的錯誤: 使用 Homebrew 安裝時可以正常工作。 我不知道該怎么辦。 rbenv 是否應該與 m1 計算機一起工作? 我有 MacOS 13.1 ...
[英]boolean field not updating in Rails
我正在構建一個基本的 crud 應用程序; 使用我的 controller 更新task的方法如下:- Tasks有一個 boolean 字段completed 。 問題是當我嘗試更新任務時,除了completed之外的所有字段都會更新。 更新completed為假給我Task updated m ...
[英]Is it possible to pattern match on a hash value to get the hash key in Ruby 3?
這是Ruby 3中關於模式匹配的一道題。 我有一個 hash: 給定 integer(例如13 ),我想找到 hash 鍵,其 hash 值包含 integer(示例中的:y )。 當然,在 Ruby 中有一些方法可以不使用模式匹配來做到這一點。 在這里,我只對在 hash上使用 Ruby 3 的 ...
[英]Ruby 3 collecting results from multiple scheduled fibers
Ruby 3 引入了Fiber.schedule來並發調度異步任務。 與這個問題(關於線程並發)中的問題類似,我想要一種在光纖調度程序上啟動多個並發任務的方法,一旦它們都被安排好等待它們的組合結果,有點等同於Promise.all in JavaScript。 我可以想出這種天真的方法:requi ...
[英]Why do Ruby fibers that run sequentially without a scheduler set run concurrently when a scheduler is set?
我有以下 Gemfile: 以及名為main.rb的文件中的以下 Ruby 代碼:require 'libev_scheduler' set_sched = ARGV[0] == "--set-sched" if set_sched then Fiber.set_scheduler Libe ...
[英]How to use HEREDOC to pass as an argument to a method?
代碼示例:create_data_with( first: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", second: <<~TEXT Aenean vel ex bibendum, egest ...
[英]Ruby - Check if datetime string is in proper format?
什么是確認字符串日期時間在 ruby 3 中的格式是否正確的干凈方法? 示例輸入是: 我查看了時間 class 並找不到任何內置方式,所以想知道我是否忽略了一些東西。 ...
[英]Why am I getting `ArgumentError: wrong number of arguments (given 1, expected 0)` on save?
在 test.save 升級到 ruby 3.1 后,我有這種方法給我一個錯誤ArgumentError: wrong number of arguments (given 1, expected 0) test.save! . 我努力了 和 (此方法調用如下Seeds::TestProgra ...
[英]Ruby 3 IRB home end and ctrl-u not working
我最近開始更多地使用 Ruby 3,似乎 home 鍵(帶我到行首)、end 鍵(行尾)和 ctrl-u(清除行)不起作用。 我正在運行帶有 Ruby 3.1.1p18 和 zsh shell 的 Arch Linux。 這些鍵在 Ruby 2.7 上運行良好。 我已經嘗試過 Alacritty ...
[英]Authlogic NameError - wrong constant name Object.const_get(camel_cased_word)
我正在嘗試使用 rails 7 設置 Authlogic gem。我有簡單的 controller: 和簡單的User model: 但是當我調用UsersController的create操作時,出現錯誤: 該錯誤指的是UsersController中的@user.save 。 我不知道發生了什 ...
[英]After upgrading to Ruby 3, unable to pass multiple arguments to my "initialize" method
我最近使用 Ruby 3 升級到 Rails 6。我在控制器中有這個 對象“初始化”方法的定義如下 但是現在在嘗試初始化對象時,我得到了錯誤 Ruby 3 在初始化期間將多個參數傳遞給對象的正確方法是什么? ...
[英]Puma causes Ruby 3 Debug to show ANSI escape sequences when pressing arrow keys (Mac ZSH)
我在使用 Z shell 的 Mac OS 12.3.1 上。 在 Puma 5.6.4 和 Ruby 3.0.0 中使用 Ruby Debug gem (1.5) 時,箭頭鍵不起作用,而是打印出 ANSI 轉義序列(例如^[[A表示向上)。 如果我沒理解錯的話,Puma 運行在 /bin/sh ...
[英]undefined method `escape' for URI:Module in ruby 3
將我的 Rails 應用程序從 Rails 6.0.1 更新到 Rails 7.0.2.3 后我遇到了寶石“回形針”的問題,'~> 6.1.0' 在應用程序中使用它時會出現錯誤: 在我的應用程序中的用法: 當 ruby gemfile 本身存在錯誤時如何解決此問題,在此先感謝。 ...
[英]Docker: TCP/IP connections on port 5342? connect to server: Connection refused Is the server running on host
我在 rails 7 中使用 rails 3.0.0。 我的 dockerfile 是: docker-compose.yml 為: database.yml 文件如下: 使用 ubunut 20.04 LTS。 出現以下錯誤:ActiveRecord::ConnectionNotEstabli ...
[英]How to avoid sending emails in Rails test-env with sendgrid-ruby?
問題我的 RSpec 測試似乎面臨一個頑固的問題,盡管我的配置應該避免它,但它試圖不斷地在 test-env 中發送電子郵件。 無論我嘗試什么,它似乎都完全忽略了它。 我的環境軌道 6.1.1 Ruby 3.0.0 sendgrid-ruby gem 6.3.9 我有一個郵件程序 class ...
[英]Troubles upgrading from ruby 2.7 to 3.0
大約一周以來,我一直在努力嘗試升級 rails 3.0。 我不完全確定問題是什么,但我認為這可能是因為我同時擁有 rvm 和 rbenv。 我在這里遵循了 gorails 的升級教程: https://gorails.com/setup/osx/12-monterey 但是每當我跑步時: $ rbe ...
[英]`require': Cannot load such file -- rdoc (LoadError)
在嘗試運行“irb”時,我遇到了這個錯誤: 從 我嘗試將 ruby 版本從 3.0.3 降級到 2.7,但沒有奏效; 有同樣的錯誤。 ...
[英]Ruby equivalent of Python's dict comprehension
我正在將 Python 項目重寫為 Ruby。 這是一個純粹的 Ruby 項目,所以沒有框架,例如附加到它的 Rails。 項目在整個地方都有很多字典理解。 例如:original = {'one': 1, 'two': 2, 'three': 3} squares = {name:value** ...