小编Dee*_*ale的帖子

Git Bash无法初始化

在此输入图像描述

当我使用git bash时,它说"无法分叉子进程:资源暂时不可用.可能需要DLL rebasing.请参阅'rebaseall --help'." 我该如何解决这个问题?

当我使用tortoiseGit来存储时,我得到了一些这样的消息

> git.exe stash save -- "12"

0 [main] sh (7224) D:\Program Files (x86)\Git\usr\bin\sh.exe: *** fatal error - cygheap base mismatch detected - 0x1360400/0x12F0400.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version.  The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution.  Rebooting …
Run Code Online (Sandbox Code Playgroud)

git bash dll

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

Rails has_many索引列不能为空

我正在创建一个消息模型,关联是

User has_many messages
Message belongs_to user
Run Code Online (Sandbox Code Playgroud)

有两种消息,一种是公开消息,另一种是私有消息。它取决于其is_public列。

这是我的消息架构

create_table "messages", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
  t.string   "title"
  t.text     "content",    limit: 65535
  t.boolean  "is_public"
  t.integer  "user_id"
  t.datetime "created_at",               null: false
  t.datetime "updated_at",               null: false
  t.index ["user_id"], name: "index_messages_on_user_id", using: :btree
end
Run Code Online (Sandbox Code Playgroud)

我认为只有私人讯息应该包含user_id

但是,我发现我无法message直接创建。

例如

m = Message.create
=> #<Message:0x007fa6724e9d80 id: nil, title: nil, content: nil, is_public: nil, user_id: nil, created_at: nil, updated_at: nil>
Message.count 
=> 0
User.first.messages << m
Message.count …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails has-many

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

Rails路由错误-未初始化的常量ArticlesController

我在以下文章中阅读了该问题的解决方案,但无法将其应用于我的案例:

我正在一个测试博客上工作,我想为新文章创建一个名为“ new.html.erb”的页面。这是代码:

<h1 align="center">Create an article</h1>
<% end %>
<%= form_for @article do |f| %>
<p>
<%= f.label :title %><br/>
<%= f.text_field :title %>
</p>
<p>
<%= f.label :description %><br/>
<%= f.text_area :description %>
</p>
<p>
<%= f.submit %>
</p>
<% end %>
Run Code Online (Sandbox Code Playgroud)

我还创建了一个名为“ articles.controller.rb”的控制器:

class ArticlesController < ApplicationController
  def new
    @article = Article.new
  end
end
Run Code Online (Sandbox Code Playgroud)

我在“ routes.rb”中添加了以下行

resources :articles
Run Code Online (Sandbox Code Playgroud)

当我尝试在Rails应用程序中访问/ articles / new时,它显示:

未初始化的常量ArticlesController

“ $耙路”给我以下输出:

      Prefix Verb   URI Pattern                  Controller#Action
        root GET    /                            pages#home
 pages_about …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails

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

Ruby on rails undefined变量

我正在编写一个新的应用程序,并使用一个旧的应用程序作为如何做我正在创建新页面和使用form_for的参考

<% form_for(store) do |f| %>

<% end %>


def new
  @store = Store.new
end
Run Code Online (Sandbox Code Playgroud)

上面是我的控制器,就像我在上一个应用程序中所做的那样,并且得到了这个错误.我收到这个令我困惑的错误,因为它适用于我制作的其他应用程序.

undefined local variable or method `store' for #<#<Class:0x007fb26b3634c0>:0x007fb26a427ce0>
Did you mean?  @store
Run Code Online (Sandbox Code Playgroud)

我必须在概念上遗漏一些东西.

ruby ruby-on-rails

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

当我尝试使用 Rails 新博客创建项目时遇到问题

这是我编辑 Gemfile 时遇到的错误,但一直说该错误 idk 为什么我安装所有 gem 和要求

错误 :

rails aborted!
TZInfo::DataSourceNotFound: tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle install
/data/data/com.termux/files/home/ruby/website/store/config/environment.rb:5:in `<main>'
/data/data/com.termux/files/home/ruby/website/store/bin/rails:5:in `<top (required)>'
/data/data/com.termux/files/home/ruby/website/store/bin/spring:10:in `require'
/data/data/com.termux/files/home/ruby/website/store/bin/spring:10:in `block in <top (required)>'
/data/data/com.termux/files/home/ruby/website/store/bin/spring:7:in `<top (required)>'

Caused by:
TZInfo::DataSources::ZoneinfoDirectoryNotFound: None of the paths included in TZInfo::DataSources::ZoneinfoDataSource.search_path are valid zoneinfo directories.
/data/data/com.termux/files/home/ruby/website/store/config/environment.rb:5:in `<main>'
/data/data/com.termux/files/home/ruby/website/store/bin/rails:5:in `<top (required)>'
/data/data/com.termux/files/home/ruby/website/store/bin/spring:10:in `require'
/data/data/com.termux/files/home/ruby/website/store/bin/spring:10:in `block in <top (required)>'
/data/data/com.termux/files/home/ruby/website/store/bin/spring:7:in `<top (required)>'
Tasks: TOP => app:template => environment
(See full trace …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails

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

Array#product RangeError:太大而无法生成

我有 93 个数组。每个数组平均有大约 18 个值,我需要对这些数组进行乘积。

所以我有一个二维数组来存储这 93 个数组。

这是我尝试做的

DATASET.first.product(*DATASET[1..-1])
Run Code Online (Sandbox Code Playgroud)

红宝石回归

RangeError: too big to product
Run Code Online (Sandbox Code Playgroud)

有谁知道一些解决方法来解决这个问题?有一些方法可以将它们分块吗?

ruby algorithm ruby-on-rails

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

标签 统计

ruby-on-rails ×5

ruby ×2

algorithm ×1

bash ×1

dll ×1

git ×1

has-many ×1