小编SEJ*_*EJU的帖子

Brew 更新中断 openssl

今天我想通过 RVM 安装一个新的 Ruby 版本,并且触发了破坏 OpenSSL 的自制软件更新。

[~]$ rvm install 2.7
.
.
.
No binary rubies available for: osx/10.14/x86_64/ruby-2.7.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Updating Homebrew...
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics

==> Auto-updated Homebrew!
Updated Homebrew from 1ea1f31d0 to c0b916764.
Updated 3 taps (homebrew/core, homebrew/cask and homebrew/services).
.
.
. …
Run Code Online (Sandbox Code Playgroud)

homebrew openssl ruby-on-rails rvm

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

MacOS 10.14安装和brew更新后无法安装mysql gem

在macOS 10.14安装+ Brew更新后我的开发系统坏了.

我无法安装mysql gem.在尝试安装时,我得到:

$ gem install mysql -v '2.8.1' --source 'http://rubygems.org/'
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

    current directory: /Users/MYACCOUNT/.rvm/gems/ruby-1.8.7-p374@WEBPROJECT/gems/mysql-2.8.1/ext/mysql_api
/Users/MYACCOUNT/.rvm/rubies/ruby-1.8.7-p374/bin/ruby -r ./siteconf20180926-49343-waujia-0.rb extconf.rb
checking for mysql_ssl_set()... yes
checking for rb_str_set_len()... yes
checking for rb_thread_start_timer()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the …
Run Code Online (Sandbox Code Playgroud)

mysql macos ruby-on-rails ruby-on-rails-3 macos-mojave

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

Rails 5/6:如何在webpacker中包含JS函数?

我正在尝试将Rails 3应用程序更新为Rails 6,并且由于无法访问我的Javascript函数,我现在的默认webpacker出现了问题。

我得到:ReferenceError: Can't find variable: functionName对于所有js函数触发器。

我所做的是:

  • 在/ app / javascript中创建一个app_directory
  • 将我的开发javascript文件复制到app_directory中,并将其重命名为index.js
  • 添加console.log('Hello World from Webpacker');到index.js
  • 已添加import "app_directory";到/app/javascript/packs/application.js
  • 添加到/config/initializers/content_security_policy.rb:

    Rails.application.config.content_security_policy do |policy|
      policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
    end
    
    Run Code Online (Sandbox Code Playgroud)

我将“ Webpacker的Hello World”登录到控制台,但是当尝试通过<div id="x" onclick="functionX()"></div>浏览器访问简单的JS函数时,出现参考错误。

我了解到资产管道已被webpacker取代,这对于包含模块来说应该是很好的选择,但是我应该如何包括简单的JS函数?我想念什么?

提前致谢?

javascript ruby-on-rails webpack webpacker ruby-on-rails-6

4
推荐指数
2
解决办法
2406
查看次数

Rails:多文件上传生成一个空条目

我正在尝试创建某种嵌套文件上传。我有图像和相册,它们通过模型 AlbumImages 相关。图像可以是相册的一部分。上传是通过Carrierwave进行的。

\n

我希望能够通过两种方式上传图像:

\n
    \n
  1. 直接通过图像
  2. \n
  3. 通过相册
  4. \n
\n

通过相册上传图像时,应将它们上传并插入到 Images 和 AlbumImages 表中。

\n

我可以通过图像上传单个图像,但令我惊讶的是,我当前通过相册上传多个图像的实现会产生 2 个单独的数据条目。(这曾经在 Rails 3 下工作)第一个条目是空的,第二个条目是我的目标。

\n
Started PATCH "/admin/albums/38" for ::1 at 2022-05-20 11:18:44 +0200\nProcessing by Admin::AlbumsController#update as HTML\n  Parameters: {"authenticity_token"=>"[FILTERED]", "album"=>{"images_attributes"=>[{"file_name"=>""}, {"file_name"=>#<ActionDispatch::Http::UploadedFile:0x00007f8f75185c70 @tempfile=#<Tempfile:/var/folders/yg/pfjwzpkx5wq9d27svk760h0h0000gn/T/RackMultipart20220520-19476-kto7za.jpg>, @original_filename="some-image.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\\"album[images_attributes][][file_name]\\"; filename=\\"some-image.jpg\\"\\r\\nContent-Type: image/jpeg\\r\\n">, "author"=>"Some Author", "copyright"=>"Someone", "funds_ids"=>["1", "6"]}]}, "commit"=>"Save", "id"=>"38"}\n  Admin Load (0.3ms)  SELECT `admins`.* FROM `admins` WHERE `admins`.`id` = 1 ORDER BY `admins`.`id` ASC LIMIT 1\n  Album Load (0.2ms)  SELECT `albums`.* FROM …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails carrierwave

3
推荐指数
2
解决办法
738
查看次数