小编Dav*_*mar的帖子

无法为Kibana安装sense插件

我正在尝试为elasticsearch/kibana安装sense插件.我已经成功安装了Kibana,但是当按照https://www.elastic.co/guide/en/sense/current/installing.html上的说明操作时, 我./kibana plugin --install elastic/sense在kibana文件夹中的bin目录中键入: ,我得到:

 ERROR  unknown command plugin

  Usage: bin/kibana [command=serve] [options]

  Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch.

  Commands:
    serve  [options]  Run the kibana server
    help  <command>   Get the help for a specific command

  "serve" Options:

    -h, --help                 output usage information
    -e, --elasticsearch <uri>  Elasticsearch instance
    -c, --config <path>        Path to the config file, can be changed with the CONFIG_PATH environment variable as well. Use …
Run Code Online (Sandbox Code Playgroud)

elasticsearch sense kibana

37
推荐指数
3
解决办法
1万
查看次数

在text_field_tag中添加一个类

我想给我的text_field_tag上课

我有这个

<%= text_field_tag :login_aei, class: 'form-control' %>
Run Code Online (Sandbox Code Playgroud)

但它不断产生这个:

<input type="text" name="login_aei" id="login_aei" value="{:class=>&quot;form-control&quot;}">
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么 ?

ruby ruby-on-rails class form-helpers

27
推荐指数
1
解决办法
3万
查看次数

如何将安装 gemfile 与特定版本的 bundler 捆绑在一起

我正在尝试捆绑安装一个运行gem 'rails', '4.2.0'. 运行Bundle install,我得到:

Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    rails (= 4.2.0) was resolved to 4.2.0, which depends on
      bundler (>= 1.3.0, < 2.0)

  Current Bundler version:
    bundler (2.1.4)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?

Could not find gem 'bundler (>= 1.3.0, < 2.0)', which is required by gem 'rails (= 4.2.0)', in any of the …
Run Code Online (Sandbox Code Playgroud)

ruby dependencies ruby-on-rails bundler

10
推荐指数
2
解决办法
8635
查看次数

在Rails中加入has_many的表

我是编程和轨道的新手,有一些我不完全理解的东西.我正在创建一个应用程序

product has_many categories
category has_many products
Run Code Online (Sandbox Code Playgroud)

如果我理解正确,我需要创建一个具有product_id&a 的连接表products_categories category_id.首先,我还需要这个表的模型吗?如果是的话,我想它会是这样的:

class CategoryProduct < ActiveRecord::Base
   belongs_to :category
   belongs_to :product
end
Run Code Online (Sandbox Code Playgroud)

和product.rb中的其他模型:

 class Product < ActiveRecord::Base
  has_many :category_products
  has_many :categories, through: :category_product
  has_attached_file :picture,
    styles: { medium: "300x300>", thumb: "100x100>" }

  validates_attachment_content_type :picture,
    content_type: /\Aimage\/.*\z/
  validates :price,               presence: { message: "Merci d'indiquer le prix du produit" }
  validates :name,                presence: { message: "Merci d'indiquer le nom du produit" }
  validates :weight,              presence: { message: "Merci d'indiquer le poids du …
Run Code Online (Sandbox Code Playgroud)

forms model ruby-on-rails jointable

7
推荐指数
1
解决办法
4594
查看次数

creating a Dynamic array class in ruby using FFI and C function

I would like to create my own dynamic array class in ruby (as a training). The idea is to have a class DynamicArray that has a capacity (the number of elements it can hold at one given moment), a size (the number of elements that were actually pushed in the array at a given moment) and a static_array which is a static array of ints of a fixed sized. Whenever this static_array is full, we will create a new static …

c ruby ffi

7
推荐指数
1
解决办法
261
查看次数

如何从 fetch 请求中的 readableStream 响应中获取可下载文件

我有一个 React 应用程序,它向我的 Rails API 发送 POST 请求。我希望我的 API 端点生成一个 csv 文件,然后将该文件发送回 React 应用程序。我希望浏览器为最终用户下载 csv 文件。

这是端点的样子:

  def generate
      // next line builds the csv in tmp directory
      period_recap_csv = period_recap.build_csv
       // next line is supposed to send back the csv as response
      send_file Rails.root.join(period_recap.filepath), filename: period_recap.filename, type: 'text/csv'
    end
Run Code Online (Sandbox Code Playgroud)

在前端,我的请求如下所示:

export function generateCsvRequest(startDate, endDate) {
  fetch("http://localhost:3000/billing/finance-recaps/generate", {
    method: "post",
    headers: {
      Authorisation: `Token token=${authToken}`,
      'Accept': 'text/csv',
      'Content-Type': 'application/json',
      'X-Key-Inflection': 'camel',
    },
    //make sure to serialize your JSON body
    body: …
Run Code Online (Sandbox Code Playgroud)

csv download stream rails-api reactjs

7
推荐指数
2
解决办法
3707
查看次数

检测上次更新期间属性值是否更改不适用于 Active Model Dirty

仅当当前更新修改了我的列状态值时,我才尝试在我的 rails 应用程序中发送通知电子邮件。我尝试按照某些帖子和status_changed?方法中的建议使用 Active Model Dirty 。不幸的是,我的电子邮件从未发送过,因为@partnership.status_changed?即使状态的值在上次更新期间确实发生了变化,也会不断返回 false。这是我的控制器代码:

  def update
    authorize @partnership
    if @partnership.update(partnership_params)
      send_notification_email
      render json: {success: "partnership successfully updated"}, status: 200
    else
      render_error(nil, @partnership)
    end
  end

  private

  def send_notification_email
    PartnershipMailer.partnership_status_change(@partnership).deliver_now if @partnership.status_changed?
  end
Run Code Online (Sandbox Code Playgroud)

我还在我的模型中包含了 Active Model Dirty :

class Partnership < ActiveRecord::Base
  include ActiveModel::Dirty
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么 ?

attributes controller ruby-on-rails activemodel

6
推荐指数
2
解决办法
1万
查看次数

onLoadEnd 未在本机反应中触发

我正在尝试在 react native 上显示来自 giphy api 的 GIF。Gif 需要时间在屏幕上显示,所以我想在中间显示一个微调器。onLoadEnd 事件似乎永远不会在 Image 标签上触发,因此微调器实际上无休止地运行,因为我永远无法在我的状态下更新加载。我在这里做错了什么?

import React, { Component } from 'react';
import { View, Text, ScrollView, Image} from 'react-native';
import axios from 'axios';
import QuoteDetail from './quote_detail'
import Spinner from './spinner'

// class based component knows when it's gona be rendered
class QuoteList extends Component {
  state = { quotes: [],
            giphyUrl: 'https://media.giphy.com/media/nZQIwSpCXFweQ/giphy.gif',
            loading: true
          };

  componentWillMount() {
    console.log('Again?')
    axios.get('https://api.tronalddump.io/search/quote?query='+this.props.characterName)
      .then(response => this.setState({ quotes: response.data._embedded.quotes }))
    this.getGiphy()
  }

  getGiphy() {
    console.log('getgif')
    const …
Run Code Online (Sandbox Code Playgroud)

events onload-event react-native

6
推荐指数
1
解决办法
3604
查看次数

即使rails服务器配置为接受所有请求,Angular post请求也不会通过预检检查

我正在使用angularJS应用程序来请求rails API.我从我的角度控制器发送我的http请求,但似乎预检请求没有通过访问控制检查:

controller('RegistrationsCtrl',['$scope', '$http', '$ionicLoading',function($scope, $http, $ionicLoading) {
  $scope.launchReq = function(){
    $http.post('http://localhost:3333/users', {email: "bou@gmail.com", password: "12345678"}).success(function(data){
      console.log(data);

      }).error(function(err){
       // $ionicLoading.hide();
       if (err.error == "Uncomfirmed account"){
          $scope.err = "Ce compte n'a pas été confirmé.<a href="+"'"+"/#/phoneConfirmation/"+err.user_id+"'"+">Obtenir votre code de confirmation ?</a>"
        }
       else {
          $scope.err = "Identifiant ou mot de passe incorrect.";
        }
     });
  }
}])
Run Code Online (Sandbox Code Playgroud)

我试图配置我的铁轨通过设置我的application.rb中的文件服务器的建议在这里:

require File.expand_path('../boot', __FILE__)

require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie" …
Run Code Online (Sandbox Code Playgroud)

post ruby-on-rails cross-domain angularjs preflight

5
推荐指数
1
解决办法
414
查看次数

SendGrid 修改电子邮件中的链接,它们不会重定向到正确的页面

我有一个使用 sengrid 在生产中运行的 rails 应用程序。在我的应用程序中,我发送了一封带有确认链接的电子邮件,该链接重定向到特定的确认页面:

%a.button.button-custom.button-blue{href: confirm_votes_path(@vote.confirmation_token, only_path: false)
Run Code Online (Sandbox Code Playgroud)

但是在生产中,Sengrid 似乎修改了我邮件中的链接。我得到类似的东西:

href="https://u3881616.ct.sendgrid.net/wf/click?upn=pVistOUxWTXmIPFqqAw0AnJt-2BbCLbreZ3xbCIcCjU0qXsxlkph8Wd3VafON-2FVyJfT0PWClbesX-2F2oOjnxeXwwaDA80aCKixoULvRGUX7PgDg59Vde4HU6spxlzuqyUUF_e4qGN2gUHpERWs59wU8LHyeuQCdWWdC4Yjpw10HvUcUonj0ZfIp-2FiYACT83qOqsHMBnkJGcBsjpIoSUjVySxVhEtqCz7myXFB-2B7uTWKruQbH-2BG7-2FI2-2BFdmXC6nbf-2FFpgyNUivvir0Upib8e5r8YJY3caF-2BpKD-2FscuINwBQkM7n008mEGADo5w5w5fejlzhopGHvJegbSRePJ-2BBu3b3olUhP2q-2BX4lyJAYvegG4xnDPU-3D"
Run Code Online (Sandbox Code Playgroud)

并且链接重定向到我网站的基本网址,而不是像本地那样好的确认网址。

SendGrid在这里发生了什么

email ruby-on-rails sendgrid

5
推荐指数
1
解决办法
2687
查看次数