ruby-on-rails

    0熱度

    1回答

    試圖在我的應用程序中具有以下關係。 產品可以屬於許多類別,子類別和子類別。 目前的設計: Product: has_many :categorizations, dependent: :destroy has_many :categories, through: :categorizations has_many :sub_categories, through: :

    0熱度

    2回答

    我的應用程序有很多不同的地方,當用戶點擊按鈕/鏈接/ div時,我通過調用ajax函數來更新數據庫。我需要在測試中包含這些功能,但我對水豚的瞭解還不夠。 下面是我想測試的一個div的示例,關聯的ajax調用以及我想要通過的測試。我應該補充一點,我正在通過Cloud9 IDE進行構建,以防有所作爲。 查看 <% @seminar.students.order(:last_name).in_group

    0熱度

    2回答

    我有驗證碼的問題,我按照一個教程: https://github.com/ambethia/recaptcha 而且在我的應用我有下: - 在文件config/initializers/recaptcha.rb Recaptcha.configure do |config| config.site_key = Rails.application.secrets.recaptcha_sit

    2熱度

    1回答

    幾個月前,我們將AMP引入了我們的Rails應用程序。我們的實現包括以下內容: <amp-analytics type="googleanalytics"> <script type="application/json"> { "vars": { "account": <%= ga.profile_code.inspect.html_safe %>

    4熱度

    2回答

    我正嘗試在Rails 5.2中使用Active Storage。我發現,我應該在遷移file類型創建領域,但我有一個錯誤: $ rdm Running via Spring preloader in process 40193 == 20171217191942 CreateDishes: migrating ===================================== --

    0熱度

    1回答

    我需要添加章節到一個頁面。聽我說。我知道這個話題已被擊敗,但我覺得我有答案,我只是不知道如何理解它。 I have been working hard to understand and implement the following tutorial in my client's store...... https://oak.works/blog/technical/2017/03/23/sh

    0熱度

    1回答

    我正在使用 rails(5.1.4) 並嘗試顯示標記了特定類別的所有帖子。我目前只能夠返回一個帖子,而不是此類別的每個帖子。 Post.rb has_many :post_categories has_many :categories, through: :post_categories extend FriendlyId friendly_id :title, use: :slugged

    2熱度

    3回答

    我創建了一個模型Tester,整數列爲tester_type,並聲明模型中的enum變量。 class Tester < ApplicationRecord enum tester_type: { junior: 0, senior: 1, group: 2 } end 我得到以下錯誤,而試圖創建/初始化該模型中的對象: ArgumentError: You tried to de

    -7熱度

    2回答

    我正在使用rails 4中的api項目。我通過命令rails g model myModel創建了所有模型,db/migrate中的某些操作已創建一個遷移數據庫文件,我不使用它這遷移。 如果我運行一些控制器,例如localhost:3000/report/data 我發現了一些錯誤。 「的遷移正在等待要解決此問題,運行: bin/rake db:migrate RAILS_ENV=developm

    0熱度

    1回答

    我有兩個模型'Product'和'Variant',產品有很多變體,現在我必須設置一個名爲「Ingridient」的變體的新模型的關聯,Variant有很多種ingridients.but在ingridents我想表明它再次HAS_ONE產品和variant.for例如 class Variant has_many :ingridients belongs_to :produc