ruby-on-rails-4

    1热度

    1回答

    我正在使用延迟作业在队列中添加一些电子邮件。我创建一个工作的方式如下: EventNotifications.reminder("email", "name", id).deliver_later 其中EventNotifications是类,提醒是它里面的方法。 这会在delayed_jobs表中创建一个作业,但是我想要创建作业的Id,因为我想更新delayed_jobs表中的一些自定义字段

    0热度

    1回答

    我将我的应用程序部署到服务器。 (Rails 5,Passenger,Nginx) 我的应用程序正在开发模式。 但我改变了我的方式来生产,这我得到这个错误(/var/log/nginx/error.log):在这个错误我换我的模式发展 [ E 2017-11-10 20:11:03.9343 21613/Tb age/Cor/App/Implementation.cpp:304 ]: Could

    0热度

    2回答

    我需要过滤嵌套散列以返回特定属性组合的项目。如果该属性存在,则返回该散列,如果该属性不存在,则返回默认值。如果该属性设置为“无”,则不返回任何内容。请看下面的哈希: { "size"=>{ "default"=>{ "jeans"=>"boyfriend" }, "blue"=>"none" }, "style"=>{ "defau

    0热度

    2回答

    鉴于Rails应用程序,其中: class Team < ActiveRecord::Base belongs_to :captain, class_name: User 我想简洁查询数据库并获得船长的总结和团队的人数它们属于: [[23, "Pat", "Smith"]] Teams: 1 [[46, "Kate", "Jones"]] Teams: 1 [[107, "Joh

    0热度

    1回答

    我试图使用rails runner访问activerecord模型。我通过了以下内容:rails runner "TabAccount.find_by_id(1).screen_name"。我知道这个模型是有效的,因为我可以使用它并查看我的Rails应用程序中的条目。 最终我想做一个班,这是一个孩子TabAccount,我越来越挂了。我想象中的脚本看起来会沿着这个线路: require Rails

    0热度

    1回答

    我有一个rails应用程序,其中我在每个页面上显示通知,并且仅在用户第一次访问我的应用程序时显示。为此我使用cookie。 application_controller.rb before_action :first_time_visit, unless: -> {cookies[:first_visit]} def first_time_visit cookies.permanent[:fi

    1热度

    1回答

    我想添加与模型错误的散列闪存和重定向后。这是控制器: def update current_user.update_attributes(user_params) if current_user.errors.any? flash.keep[:errors] = current_user.errors.messages end byebug

    1热度

    1回答

    我正在使用Rails 5和Devise进行Ajax身份验证。表格用户列已被阻止,如果用户被阻止,他将被注销。我已经设置标题为阿贾克斯全球: $(document).ajaxSend(function(e, xhr, options) { var token = $("meta[name='csrf-token']").attr("content"); xhr.setReques

    0热度

    1回答

    我遇到了一些问题以找到此错误来自哪里。 我收到此错误: 我不知道,它的问题是与我的观点文件夹的命名做的,我把它命名为财产...而不是性质(我已经尝试过改变,但我仍然得到一个错误) 这是我的模型是什么样子 class Property < ApplicationRecord validates :address, presence: true, length: {minimum: 10}

    0热度

    1回答

    试图在我的应用程序中具有以下关系。 产品可以属于许多类别,子类别和子类别。 目前的设计: Product: has_many :categorizations, dependent: :destroy has_many :categories, through: :categorizations has_many :sub_categories, through: :