小编cpt*_*ter的帖子

Rails 6 ActionMailbox 与 Mailgun 返回 404

我正在 Rails 6 上使用 ActionMailbox 开发一个内部费用应用程序来替换 Excel 电子表格。由于我们的许多收据现在采用电子邮件形式(例如机票),因此用户只需将收据转发到应用程序,它就会自动与费用条目相关联。

我使用 ActionMailbox 和 Mailgun 作为电子邮件接收器。正如 Gorails Pro 教程所建议的,我已使用 localtunnel 将我的应用程序公开到通用互联网。我已经使用 Mailgun 的功能向我的应用程序发送了一封测试电子邮件。

我的邮寄地址是:

https://xxxxxxxx.localtunnel.me/rails/action_mailbox/mailgun/inbound_emails/mime
Run Code Online (Sandbox Code Playgroud)

但是,我遇到了一个问题,即来自 Mailgun 的传入电子邮件未得到正确处理,而是返回 404 错误。Rails 日志显示以 POST 形式接收的消息。日志中的最后两个条目是:

2019-10-15T07:50:07.646Z 10260 TID-gn609ivg8 INFO: Filter chain halted as :ensure_configured rendered or redirected
2019-10-15T07:50:07.646Z 10260 TID-gn609ivg8 INFO: Completed 404 Not Found in 0ms (ActiveRecord: 0.0ms | Allocations: 144)
Run Code Online (Sandbox Code Playgroud)

我的配置是: config/routes.rb

https://xxxxxxxx.localtunnel.me/rails/action_mailbox/mailgun/inbound_emails/mime
Run Code Online (Sandbox Code Playgroud)

配置/应用程序.rb

2019-10-15T07:50:07.646Z 10260 TID-gn609ivg8 INFO: Filter chain halted as :ensure_configured rendered or redirected
2019-10-15T07:50:07.646Z 10260 TID-gn609ivg8 INFO: Completed 404 Not …
Run Code Online (Sandbox Code Playgroud)

ruby mailgun ruby-on-rails-6

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

在 Julia 中使用元组有键而不初始化字典

我是朱莉娅的新手。对于我的应用程序,我有一个昂贵的操作来计算基于两点的矩阵。计算出的矩阵将被多次使用,因此我想将它们缓存在字典中。然而,我在 Julia 中遇到了一个奇怪的行为。如果我添加第一个(键,值)对作为字典初始化的一部分,那么一切都会按预期工作。然而,如果我不这样做,并尝试稍后添加我的第一个(键,值)对,朱莉娅就会崩溃。

p1 = [ 2.0, 1.0, 1.0]
p2 = [ 4.0, 2.0, 1.0]

# This works
my_dict = Dict{Tuple{Array{Float64,1}, Array{Float64,1}}, String}(
    (p1, p2) => "hello world"
)
println(my_dict[(p1, p2)])

# This works
my_dict[ (p2, p1)] = "hello again"
println(my_dict[ (p2, p1)] )

# This doesn't
my_dict2 = Dict{Tuple{Array{Float64,1}, Array{Float64,1}}, String}
my_dict2[(p2, p1)] = "this fails with method dispatch error"
Run Code Online (Sandbox Code Playgroud)

朱莉娅的输出:

julia complex_key_for_dict.jl 
hello world
hello again
ERROR: LoadError: MethodError: no method matching setindex!(::Type{Dict{Tuple{Array{Float64,1},Array{Float64,1}},String}}, ::String, ::Tuple{Array{Float64,1},Array{Float64,1}})
Stacktrace:
 [1] top-level …
Run Code Online (Sandbox Code Playgroud)

dictionary julia

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

标签 统计

dictionary ×1

julia ×1

mailgun ×1

ruby ×1

ruby-on-rails-6 ×1