我在向单元格添加注释时遇到了实际困难.
我打电话给以下子
Sub ValidationError(row As Long, column As Integer, ErrorLine As String)
Tabelle1.Cells(row, column).Interior.Color = vbYellow
Tabelle1.Cells(row, column).AddComment ErrorLine
End Sub
Run Code Online (Sandbox Code Playgroud)
但我总是得到一个1004错误,说"应用程序或对象错误"(这是翻译,原始消息:"Anwendungs-oder objektdefinierter Fehler")
该子被称为使用
Call ValidationError(8, 9, "Text string")
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
最好
我有一个Select2 Box,启用了标记以添加新的自己的标记。选择一个现有选项不会有任何问题(任何长度)。但是有些代码使我无法添加长度超过2个字符的新选项(只是不能添加更多字符)。参见JSFiddle
<select class="form-control select2" multiple="multiple" id="employee-groups-select" name="employee[employee_group_ids][]">
<option value="4">Text1</option>
<option value="1">Text2</option>
<option value="3">Text3</option>
<option value="2">Text4</option>
</select>
Run Code Online (Sandbox Code Playgroud)
jQuery代码初始化select2
$('#employee-groups-select').select2({
theme: 'bootstrap4',
tags: true,
width: '100%',
tokenSeparators: [',', ' '],
});
Run Code Online (Sandbox Code Playgroud)
非常感谢您的帮助。我不知道在哪里看。
我有一个带有头像的Employee模型。我可以将图像附加到头像上,但是每当我尝试显示图像时,
url_for(@employee.avatar)
Run Code Online (Sandbox Code Playgroud)
产生无效链接。我所看到的只是标签中alt属性的值。我得到的图像标签如下
<img src="/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBDZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--4786aa4d9d82d8f8d572b857965088b20fcb2f49/Portrait.jpg"
alt="Thumbnail">
Run Code Online (Sandbox Code Playgroud)
而且我知道图像已正确附加。当我打电话给我时,我得到这个结果:
@employee.avatar
=> #<ActiveStorage::Attached::One:0x00007ff7e9ba41c0 @name="avatar",
@record=#<Employee id: 4, first_name: "Meda", last_name: "Burgdorf",
created_at: "2019-03-03 23:03:00", updated_at: "2019-03-03 23:17:56">,
@dependent=:purge_later>
Run Code Online (Sandbox Code Playgroud)
非常感谢您的帮助。谁能帮我显示保存的图像。
这是我的设置。
class Employee < ApplicationRecord
has_one_attached :avatar
...
end
Run Code Online (Sandbox Code Playgroud)
我的storage.yml文件的内容
local:
service: Disk
root: <%= Rails.root.join("storage") %>
Run Code Online (Sandbox Code Playgroud)
我从Active Storage的迁移已迁移。查看我的schema.rb文件
ActiveRecord::Schema.define(version: 2019_03_03_211537) do
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
t.integer "record_id", null: false
t.integer "blob_id", null: false
t.datetime "created_at", null: false
t.index ["blob_id"], name: …
Run Code Online (Sandbox Code Playgroud) 我目前正在学习红宝石,但我不能让我的嵌入式红宝石进行探索性工作,我将不胜感激.
我基本上试图在我的嵌入式ruby中编写这个if语句的简短版本
<% entity.attributes.each do |key, value| %>
<%= if key == "name"
link_to @entity, edit_entity_path(entity)
else
value
end %>
<%= end %>
Run Code Online (Sandbox Code Playgroud)
根据我的理解(和这篇文章),它应该像这样写
<% entity.attributes.each do |key, value| %>
<%= key == "name" ? link_to @entity, edit_entity_path(entity) : value %>
<%= end %>
Run Code Online (Sandbox Code Playgroud)
这似乎不起作用.我究竟做错了什么?
Ralils错误消息: 语法错误,意外的tIVAR,期待keyword_do或'{'或'('... ey =="name")?...
请事先提供帮助