【发布时间】:2015-02-24 22:01:19
【问题描述】:
我正在使用 Heroku Postgres :: Onyx 的爱好层运行托管在 Heroku 上的 rails 4.0.2 应用程序。我的日志文件中有一个奇怪的错误,并且记录无法保存。我无法重现错误。
2014-05-23T05:28:33.443728+00:00 app[web.1]: [2014-05-23 05:28:33] ERROR invalid body size.
这个错误奇怪的原因是我的应用程序中唯一的正文字段是一个文本字段。
以下是相关架构:
create_table "invitation_templates", force: true do |t|
t.integer "business_id"
t.string "subject"
t.text "body"
t.datetime "created_at"
t.datetime "updated_at"
end
这是我的模型(顺便说一下,其中不包含验证):
class InvitationTemplate < ActiveRecord::Base
belongs_to :business
end
这是完整的控制器:
定义创建
# @user set by correct_user
# @business set by correct_user
@invite = Invite.new(invite_params)
if @invite.valid?
invtemp = InvitationTemplate.find_or_create_by(business_id: @business.id)
invtemp.subject = @invite.subject
invtemp.body = @invite.message
invtemp.save # <--- This is the only line that I can think of as having thrown the error
if invite_params[:image_file].present?
uploaded_io = invite_params[:image_file]
@invite.image_id = Image.add_or_update( @invite.image_id, uploaded_io, "invites" )
end # if params[:image_file].present?
inviter = ManInvite.new
res = inviter.sendInvitation(@invite, @business)
if res
flash[:notice] = "We sent your message(s). You will recieve an email when a new testimonial has been submitted."
else
flash[:error] = "We saved your message(s). But had a problem sending. Please contact support with this information: #{@invite.status} #{@invite.audit_id}"
end
if params[:send_another]
redirect_to( new_business_invite_path(@business) )
else
redirect_to( business_dashboard_index_path(current_user.businesses.first()) )
end
else
render 'new'
end
结束
我认为文本字段不会引发大小错误。对此错误的原因/来源的任何想法将不胜感激。
【问题讨论】:
-
你做了什么来尝试在本地复制它?你的控制器代码是什么样的?
-
就娱乐而言,我已经用无数不同的身体值执行了这段代码。包括那些一开始没有保存并且它们都正确保存的那个(我有一个失败值的副本,因为它被传递给 ManInvite.sendInvitation,它将值写入审计日志)。
标签: ruby-on-rails ruby postgresql heroku