-
0 votesanswersviews
嵌入式应用程序未显示在管理员身上 - Shopify
我已经在Shopify商店创建并安装了一个应用程序,使用shopify 's partners YouTube channel guide. I am using shopify_app gem and using Ruby on Rails(5.2). When I try to access the app using apps section in admin and click on my... -
0 votesanswersviews
ActiveRecord :: ConcurrentMigrationError:使用mysql2和rails 5.2
从4.2升级到rails 5.2后,任何迁移都会抛出: ActiveRecord :: ConcurrentMigrationError:无法运行迁移,因为当前正在运行另一个迁移过程 . 数据库适配器是mysql2 最初我认为这是因为我在开发环境中导入的现有 生产环境 数据库中的一些陈旧数据 . 但同样的问题发生在一个干净的数据库中 . 为了克服它(因为我真的需要在其他一些问题上取得进展),我不得... -
0 votesanswersviews
Rails 5.2.0 images.attach导致InvalidSignature错误
我正在升级到Rails 5.2.0并尝试使用ActiveStorage来保存数据源中的图像 . 在 development.rb 我有 config.active_storage.service = :local ,模型有 has_many_attached :images , storage.yml 有默认的 :local 设置,控制器动作有 def listing_params p... -
1 votesanswersviews
Rails控制器测试未定义的方法variable_size_secure_compare
从Rails 5.1升级到5.2后,从使用HTTP Basic Auth测试的控制器获取以下错误: undefined method `variable_size_secure_compare' for ActiveSupport::SecurityUtils:Module -
2 votesanswersviews
如何通过Active Storage禁用自动生成的路由
我正在将现有应用程序升级到Rails 5.2 . 旧应用程序正在使用Paperclip进行文件存储,我正在尝试将其移至ActiveStorage . 我的应用程序公开了一个API,允许用户安全上传文件(使用密钥/密钥对签名请求) . 当我安装ActiveStorage时,我发现了几条新路线 rails_service_blob GET /rails/active_storage/blobs/:s... -
6 votesanswersviews
无法在Rails中使用ActiveStorage创建文件字段
我正在尝试在Rails 5.2中使用Active Storage . 我发现我应该在迁移中创建类型为 file 的字段,但是我有一个错误: $ rdm Running via Spring preloader in process 40193 == 20171217191942 CreateDishes: migrating ===================================... -
13 votesanswersviews
ActiveStorage文件附件验证
有没有办法用ActiveStorage验证附件?例如,如果我想验证内容类型或文件大小? 像Paperclip这样的方法会很棒! validates_attachment_content_type :logo, content_type: /\Aimage\/.*\Z/ validates_attachment_size :logo, less_than: 1.megabytes -
6 votesanswersviews
Rails 5 ActiveStorage中的ImageOptimization
我计划在我的一个网站上将Rails升级到5.2并引入ActiveStorage,截至目前我使用Paperclip和paperclip_optimizer . 其中一个不利的方面是,当用ActiveStorage替换回形针时,我将丢失优化器 . 如何在ActiveStorage中实现用户上传的自动图像优化? -
1 votesanswersviews
发送图像时,Rails 5.2 ActionCable和ActiveStorage
我尝试将数据从客户端传递到服务器端,按照ActiveStorage的一些ActionCable教程创建映像记录,但它不起作用 . 这是我的代码:来自客户端的代码确实传递到服务器端但我无法通过ActiveStorage创建新映像 . 请帮助我解决它并让我知道它为什么会发生 . 谢谢 . 我测试了传递图像为base64 / blob(我真的不知道) Room_channel.rb def image(... -
1 votesanswersviews
Rails 5.2 API ActiveStorage如何获取多图像的URL路径?
我正在从paperclip迁移到Rails 5.2和活动存储 . 我使用rails作为API . 如何获取has_many_attached:images的URL路径 这是有效的单个文件的代码: class UserSerializer < ActiveModel::Serializer include Rails.application.routes.url_helpers attribu... -
1 votesanswersviews
Rails ActiveStorage - 通过Rails控制台访问
ActiveStorage 创建了2个表 active_storage_blobs 和 active_storage_attachments . 我想知道是否有办法通过Rails控制台轻松访问它们(即架构迁移内部表可以通过 ActiveRecord::SchemaMigration 访问)? -
1 votesanswersviews
Rails 5.2 Rest API Active Storage React - 将附件URL添加到控制器响应中
想要为附加文件添加url,同时响应获取父资源(比如Person)的嵌套资源(比如Document)的请求 . # people_controller.rb def show render json: @person, include: [{document: {include: :files}}] end # returns # {"id":1,"ful... -
3 votesanswersviews
Rails 5.2 Rest API Active Storage - 上载从外部服务接收的文件blob
我们正在从外部服务接收POST调用,该服务包含文件blob(以Base64编码)和一些其他参数 . # POST call to /document/:id/document_data param = { file: <base64 encoded file blob> } 我们希望处理该文件并将其上传到以下模型 # MODELS # document.rb class ... -
2 votesanswersviews
Rails Active Storage Variant选项
重现的步骤 class Product < ApplicationRecord has_many_attached :images end 在视图中: <%= image_tag(url_for(@product.images.first.variant(resize: "100x100", flip: "-90"))) %> 预... -
0 votesanswersviews
活动存储:在模型更新上更新S3,在模型删除上删除S3
我在Rails 5.2.1上使用Active Storage 我已经按照教程进行操作,并且我正在使用凭据在我的 storage.yml 中进行设置 amazon: service: S3 access_key_id: <%= Rails.application.credentials.aws_access_key_id! %> secret_access_key: <... -
0 votesanswersviews
将图像添加到rails 5.2活动存储中的种子数据库
只是尝试将图像添加到我的种子文件中 . 尝试使用Rails 5.2中的新活动存储添加时遇到一些问题 谁能发现正在发生的事情 . 这是db中后面跟着错误的代码 . 谢谢 . 25.times do temp = Post.create([{ title: Faker::Book.unique.title, content: Faker::Lorem.paragraphs(rand(1... -
1 votesanswersviews
如何使用Active Storage存储URL中的图像
我的问题是:当我使用Active Storage时,如何从URL上传图像 . 我在Stackoverflow中使用了其他post中的代码,但是通过模型方法,我需要存储在我的表中的param . 奇怪的是,我收到了下一个错误: ActiveSupport::MessageVerifier::InvalidSignature in PostsController#update 但是当我重新加载节目视图... -
10 votesanswersviews
在Rails 5.2中禁用活动存储
将Rails升级到5.2,我发现我必须将storage.yml提交到版本控制中 . 我不打算使用ActiveStorage . 有没有办法禁用它? -
4 votesanswersviews
如何将我的附件的url存储在rails控制器的活动存储中
如何在我的rails控制器中获取存储在活动存储中的has_one模型附件的URL . 所以,我可以在json中将其作为api的完整链接发送 . 到目前为止,我尝试了以下方法,但每个方法都提出了各种问题: 1)current_user.image.service_url ----未定义的方法`service_url'for# 2)Rails.application.routes.url_helper... -
0 votesanswersviews
修改源代码后收到CanCan :: AccessDenied错误
我是StackOverFlow的新人 . 很高兴见到你 . 现在,我正在使用Spree Framework制作EC Rails应用程序 . 狂欢管理员角色用户都很好 . 但是,在TextEditor中修改源代码后,自定义角色用户重定向到authentication_failure . 进程发生错误如下: 创建自定义用户角色'sub_admin' . 创建用户有'sub_admin'角色; ... -
0 votesanswersviews
将current_user id分配给导入学生列表
其实我正在尝试将Excel文件导入rails 5应用程序 . 导入时我收到错误, ActiveRecord::RecordInvalid (Validation failed: User must exist) 这是我的student.rb class Student < ApplicationRecord belongs_to :user mount_uploader :ima... -
17 votesanswersviews
使用Rails 5.2 ActiveStorage创建和保存pdf,然后附加到电子邮件
我担心新的主动存储功能会出现问题 . 我想要做的是创建一个pdf(我正在使用WickedPdf)并将其附加到模型 . 这是第一个问题,我到目前为止唯一想到的是首先写入文件,然后打开此文件以创建附件 . self.document.attach( { filename: "filename.pdf", io: File.open(pdf_document) }) 有没有... -
2 votesanswersviews
Rails 5.2 Active Storage清除/删除附件不会删除Blob或Attachent记录
我正在使用rails 5.2,我正在尝试使用Amazon S3设置Active Storage . 我的应用程序具有对S3的完全访问权限,并且我能够将 avatar 图像附加到 user . 但是当我尝试删除头像时,我遇到了以下问题: > user.avatar.attached? #true` > user.avatar.purge S3 Storage (697.9ms) ... -
2 votesanswersviews
如何将供应商资产导入webpacker?
我在供应商/样式表和供应商/ javascript目录中添加了一些javascript和css库 . 我无法在我的app / javascript / packs / application.js中导入这些内容 . 我使用webpacker作为我的资产管道 .