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