小编Ste*_*lar的帖子

E117:未知功能:ale#Lint

我尝试升级我的.vimrc文件。当我打开正在处理的 Rails 应用程序时,出现以下错误。

rails_app/config/environments/development.rb                                                                    2,3            Top
Error detected while processing CursorHold Auto commands for "*":
E117: Unknown function: ale#Lint
Press ENTER or type command to continue
Run Code Online (Sandbox Code Playgroud)

我猜这个错误是从下面一行中从Ale引发的。

" ALE linting events
augroup ale
  autocmd!

  if g:has_async
    set updatetime=1000
    let g:ale_lint_on_text_changed = 0
    autocmd CursorHold * call ale#Lint()
    autocmd CursorHoldI * call ale#Lint()
    autocmd InsertEnter * call ale#Lint()
    autocmd InsertLeave * call ale#Lint()
  else
    echoerr "The thoughtbot dotfiles require NeoVim or Vim 8"
  endif
augroup END
Run Code Online (Sandbox Code Playgroud)

我有vimrc.bundles …

vim vim-plugin

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

无法使用 Tailwindcss 将表单居中

我目前正在开发 Rails 6 应用程序并制作表单。我想将表单居中放置在页面中间。我使用 Tailwindcss 来设置页面样式。但是当我添加 with 时,如果移动到页面右侧,它不会居中。

在此处输入图片说明

表格如下所示:

<div class="max-w-full">
  <%= form_for @post do |f| %>
    <div class="md:flex md:items-center mb-6">
      <div class="md:w-1/3">
        <label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-full-name">
            <%= f.label :title, 'Title:' %>
        </label>
      </div>
      <div class="md:w-2/3">
        <%= f.text_field :title, class: "bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" %>
      </div>
    </div>

    <div class="md:flex md:items-center mb-6">
      <div class="md:w-1/3">
        <label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-full-name">
            <%= f.label :description, 'Description:' …
Run Code Online (Sandbox Code Playgroud)

css tailwind-css

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

错误1833(HY000):无法更改列MySQL

我试图将自动增量添加到person_id人员表的主键。但是,当我运行命令时,出现以下错误。

错误1833(HY000):无法更改列“ person_id”:用于表“ bank.favorite_food”的外键约束“ fk_fav_food_person_id”

用于以下命令。我正在使用MySQL 5.7.20

mysql> ALTER TABLE person MODIFY person_id SMALLINT UNSIGNED AUTO_INCREMENT;
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

mysql sql

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

未初始化的常量 ActionView::Template::Handlers::ERB::ENCODING_FLAG

我目前正在开发 Rails 应用程序版本Rails 4.2.6ruby 2.2.2. 我正在尝试运行 rspec 测试,我有版本

 rspec-core 3.7.1
  - rspec-expectations 3.7.0
  - rspec-mocks 3.7.0
  - rspec-rails 3.7.2
  - rspec-support 3.7.1
Run Code Online (Sandbox Code Playgroud)

当我运行以下命令时bundle exec rspec spec/models/user_spec.rb,出现以下错误:加载 ./spec/models/user_spec.rb 时发生错误。

失败/错误:需要“rspec/rails”

NameError: 未初始化的常量 ActionView::Template::Handlers::ERB::ENCODING_FLAG

这是我的 rails_helper.rb

# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
require "rspec/rails"
require "capybara/rspec"

ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in …
Run Code Online (Sandbox Code Playgroud)

rspec rspec-rails ruby-on-rails-4

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

'method_missing':(NoMethodError)的未定义方法'active_storage'

我目前生成了Ruby on Rails 5.2应用程序。当我运行rails active_storage:install它时,它创建了一个20180915211415_create_active_storage_tables迁移。但是,尝试启动服务器时遇到以下错误。

/Users/stevenaguilar/.rvm/gems/ruby-2.2.2/gems/railties-5.2.1/lib/rails/railtie/configuration.rb:97:in `method_missing': undefined method `active_storage' for
#<Rails::Application::Configuration:0x007f80bbbf1c18> (NoMethodError)
Run Code Online (Sandbox Code Playgroud)

这是我的gemfile:

source 'https://rubygems.org'

git_source(:github) do |repo_name|   repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")   "https://github.com/#{repo_name}.git" end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.2'
# Use postgresql as the database for Active Record gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server gem 'puma', '~> 3.7'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker'
# Build …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails rails-activestorage

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

添加两个变量,使它们成为一个在Ruby中具有空格的String

所以我试图在同一行输出两个带空格的字符串变量,但是我收到以下错误:

在`+'中:没有将Fixnum隐式转换为String(TypeError)

对于以下代码

puts s1 + " " + s2
Run Code Online (Sandbox Code Playgroud)

如何修复此代码以使用空格和字符串变量s2的值在同一行上打印字符串变量s1的值?例如

s1 = "hello" s2="world"  output "Hello world"
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails

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

.vimrc:第4行:意外令牌'('附近的语法错误

我正在尝试配置Vim。但是,当我.vimrc在编辑文件后尝试获取源代码时,出现以下错误:

$ source〜/ .vimrc -bash:让g:plug_shallow = 0:找不到命令-bash:/Users/stevenaguilar/.vimrc:第4行:意外的令牌(' -bash: /Users/stevenaguilar/.vimrc: line 4:调用plug#begin()附近的语法错误

我不知道此错误来自何处。它在call plug#begin()关闭的行上引发错误。这是完整的.vimrc

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:plug_shallow = 0 " disable shallow cloning

call plug#begin()

Plug 'airblade/vim-gitgutter'                 " shows a git diff in the gutter
Plug 'altercation/vim-colors-solarized'       " precision colorscheme
Plug 'godlygeek/tabular'                      " text filtering and alignment
Plug 'janko-m/vim-test'                       " test runner
Plug 'phallstrom/vim-sailfish'
Plug 'scrooloose/nerdtree'                    " tree explorer
Plug 'sjl/gundo.vim'                          " graph your vim undo tree
Plug 'tpope/vim-commentary'                   " comment stuff out
Plug …
Run Code Online (Sandbox Code Playgroud)

vim

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

PHP Fatal error: Uncaught Error: Class Exception not found

I'm getting roadblocks trying to add error handling to PHP. Currently I have a try and try and catch to handle an error when a $db is trying to insert-> write into a DB that is --read-only. I get the following error:

PHP Fatal error: Uncaught Error: Class 'StatCollector\Exception' not found in wp-content/mu-plugins/stat-collector/StatCollectorFunctions.php

<?php

namespace StatCollector;

function drools_request($data, $uid) {
  try {
    $db = _get_db();
    $insertion = $db->insert("requests", [
      "uid" => $uid,
      "data" => json_encode($data),
    ]);
    if( !$insertion ) …
Run Code Online (Sandbox Code Playgroud)

php wordpress

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

在Ruby中将输出存储到数组中

所以我需要创建一个接受名称数组并输出一组字符串的方法.如何将输出存储到数组中?所以我没有一个名字数组,而是有一系列的问候?

def badge_maker(array)
  array.each do |i|
    counter = 0
    while counter < 7
      array[counter] << "Hello, my name is #{i}."
      counter += i
    end
    return array
  end
end
arrayOne = ["Edsger","Ada","Charles","Alan","Grace","Linus","Matz"]

badge_maker(arrayOne)
Run Code Online (Sandbox Code Playgroud)

ruby rspec ruby-on-rails

0
推荐指数
1
解决办法
56
查看次数