我尝试升级我的.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 …
我目前正在开发 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) 我试图将自动增量添加到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)
我目前正在开发 Rails 应用程序版本Rails 4.2.6和ruby 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) 我目前生成了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) 所以我试图在同一行输出两个带空格的字符串变量,但是我收到以下错误:
在`+'中:没有将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) 我正在尝试配置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) 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) 所以我需要创建一个接受名称数组并输出一组字符串的方法.如何将输出存储到数组中?所以我没有一个名字数组,而是有一系列的问候?
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)
rspec ×2
ruby ×2
vim ×2
css ×1
mysql ×1
php ×1
rspec-rails ×1
sql ×1
tailwind-css ×1
vim-plugin ×1
wordpress ×1