![](/img/trans.png)
[英]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 正在運行並且位於 ...
[英]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 正在運行並且位於 ...
[英]Zeitwerk + Rails 6.1 with model and namespaced subclasses, "earlier autoload discarded"
在對 SO 和 Rails 的 GitHub 問題中的一個非常相似的問題進行研究之后,我仍然不清楚出了什么問題。 我的命名空間 model 子類不是預先加載的,但我相信它們已正確聲明並位於正確的位置。 它們似乎是自動加載的並且可以訪問,但是在它們被實例化之前,每個都不會出現在父subclasses ...
[英]Correct way to set yaml_column_permitted_classes for a custom class
由於此安全公告,序列化屬性需要使用 YAML.safe_load 和允許類的安全列表。 我遇到的問題是我想使用自定義 class (Foo::Bar) 並且看起來至少在 Rails 6.1 中您需要在application.rb中將允許的類設置為啟動過程的開始。 config.active_r ...
[英]nested attributes with has many through
當我從 UI 傳遞值時,我得到了未經許可的參數。 模型之間的關聯是多對多的。 帖子/_form.html.erb 當我運行下面的行時,它給出了未經許可的參數 圖式 我錯過了一些重要的東西嗎? 任何幫助表示贊賞導軌 - 6.1 ruby - 3.0 ...
[英]Multipart email with ical attachment displays incorrectly
我不確定這是否是我的代碼、 ActionMailer 、 Mail或什至是icalendar gem 的問題? 用戶注冊一個事件,他們會得到一個帶有 ical 附件的 email:# app/mailers/registration_mailer.rb class RegistrationMail ...
[英]Rails where method with any created_at
我有這樣的方法:def transfers(material, capacity, category, created_at) transfers_range = Transfer.first.created_at..Transfer.last.created_at if created_at. ...
[英]How can I refresh all the cookies, token and session after logout calling API using Rails Hotwire
我正在開發一個在 Rails Hotwire 中完成的項目,其中 devise gem 已用於身份驗證,並且在前端 Stimulus.js 中已使用。 而不是使用link_to,我想用刪除方法編寫一個API,像這樣刷新:cookies,令牌,導致時間延遲需要一些時間來刪除所有造成問題的東西: 我的 ...
[英]Rails Model no longer available in initializer after upgrade to Rails 7.0
我有一個 Rails 初始化程序 ( features.rb ),它必須訪問 model ( Report )。 使用 Zeitwerk 和 6.1 的默認設置,這一切都與 Rails 6.1 完美配合: 但是升級到 Rails 7,將默認值保持在 6.1(並且顯然使用 Zeitwerk),它不起作 ...
[英]Resolvers in GraphQL do not seem to get context
我在query_type中使用解析器: 在我的resolvers文件夾中有一個base文件: 但是,當我嘗試在解析器代碼中使用current_user_id時,它會中斷: 說: "undefined method 'id' for nil:NilClass" 有什么線索嗎? ...
[英]Rails 6 credentials constantly broken
我們正在運行 Rails v6.1.4 並且加密的憑據不斷中斷,我們無法弄清楚為什么...... 我們為各種環境提供了四組憑據: *.key 文件都是.gitignore編輯的。 跟蹤 *.yml.enc。 該項目有兩名開發人員。 我們偶爾會使用以下命令更新憑據: rails credential ...
[英]Rails Need help to capture form field in model from product view
我需要在產品展示頁面內捕獲用戶在 form_for 中添加的字段。 我的product.rb model如下: 我的投訴.rb model 如下: 我的 user.rb model 如下: 我的產品 controller 是一個基本的 controller,具有所有新的、創建、編輯、更新操作,所有路 ...
[英]Ruby on Rails 6 - Credentials preventing rake tasks from loading on Heroku
我正在嘗試將應用程序從 Rails 6 升級到 Rails 6.1.6.1,但使用憑據時遇到以下錯誤。 我的生產憑證文件包含以下內容:aws: bucket_prefix: "some-prefix" 但是當我嘗試部署到 Heroku 時,我得到以下信息:-----> Detecting ...
[英]find_or_create_by in the ruby jsonb column
Ruby 中的 jsonb 有find_or_create_by嗎? 我想得到一個有something標題的項目{ title: {en: 'something', de: 'something' } 代替Model.where(sanitize_sql("title->> '#{I ...
[英]how to render partial without variable with turbo
我通過互聯網搜索,但我只找到“更新后如何渲染部分”等。現在我點擊圖片,頁面正在引用並出現部分。 但是這個令人耳目一新的部分……對我不利,所以我想知道……我可以用 Turbo 渲染部分(或者如果我已經渲染過的話就替換)嗎? Ruby 版本:3.0.4 導軌版本:6.1.6 我的觀點: 我的“外國伙伴 ...
[英]Facing ActiveRecord::NotNullViolation Exception: PG::NotNullViolation: ERROR: null value in column "item_id" violates not-null constraint
我正面臨ActiveRecord::NotNullViolation Exception: PG::NotNullViolation: ERROR: null value in column "item_id" violates not-null constraint錯誤。 我不知道如何解決這個錯誤 ...
[英]How use rails inflections with diferent languages
我使用Rails 6.1.4 ,我需要配置 2 種語言的變形,但是當我嘗試使用復數時,這個詞不適用復數。 我需要以不同的語言應用不同的規則,但不起作用。 ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.plural( ...
[英]Rails 6.1 - JS stops working after clicking on any button
我有一些通過渠道鏈接到 application.html.erb 的 JS 函數。 加載頁面時,它們都可以正常工作。 但是,如果我單擊頁面上的任何按鈕 (href=""),JS 似乎停止工作並且我的任何功能都不再適用。 這是 application.html.erb 文件: 功能之一: ...
[英]How to efficiently operate on two joined tables in Ruby On Rails
我有兩個表:Transfers 和 Releases。 我需要將它們加入一個有序數組 如您所見,有一個問題。 每次我想查看另外 27 條記錄(我正在使用 'will-paginate' gem)時,它都會再次觸發此查詢。 有沒有辦法只做一次然后對這個數組進行操作? 附言。 對不起,我的英語不好 ...
[英]Zeitwerk doesn't requires lib classes properly in Rails 6.1.6
我正在嘗試將我的應用程序從 Rails 5.2 更新到 6.1,並使用 Zeitwerk 自動加載,但我在自動加載/lib類時遇到了一些問題。 我將其包含在config/application.rb中: 而且,當我運行zeitwerk:check時,它會提醒我: 它被聲明為: 當我嘗試 ...
[英]Issue Deploying Rails 6.1 to AWS Elastic Beanstalk
有關將 Rails 部署到 AWS Elastic Beanstalk 的任何提示? 我開始有真正的困難。 我解決的每個錯誤都會導致另一個錯誤。 現在它有編譯資產warning: shebang line ending with \r may cause problems ,所以我現在通過將一個環 ...