使用gmail帐户开发的Rails 3.2.8应用程序作为"发送地址".邮件发送工作时我的environment.rb文件包含:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:authentication => :login,
:user_name => "accountname",
:password => "123456789"
}
Run Code Online (Sandbox Code Playgroud)
我在我的应用程序日志中收到此消息:EOFError(到达文件末尾):当上面的代码更改为如下所示:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "mail.company.com",
:port => 25,
:domain => "company.com",
:authentication => :login,
:user_name => "accountname",
:password => "123456789"
}
Run Code Online (Sandbox Code Playgroud)
我可以告诉您,我可以向电子邮件地址发送手动电子邮件,并在使用ThunderBird等电子邮件客户端时看到它,因此我知道accountname@company.com正常运行.
我不明白文件结束错误是如何发挥作用的.我也无法弄清楚如何获得更多信息出现在日志中.
我期待着阅读一些确定文件结束原因的建议.
Started POST "/sendInvites?locale=en&lot_id=18&user_id=17" for 99.99.99.99 at 2013-10-03 08:52:09 -0700
Processing by WaitingListsController#sendInvites as HTML
Parameters: {"authenticity_token"=>"uwz/6pW1rLPXR4gU3m3OwCmU0O3DSJ/haNM2/ai+OR8=", "locale"=>"en", "lot_id"=>"18", "user_id"=>"17"}
=======>>>> Beginning Send Invitation Process …Run Code Online (Sandbox Code Playgroud) 我有两个型号,父母是财产,孩子是电话.尝试使用嵌套的Phone数据创建新的Property记录时,收到错误消息:Phones属性必须存在.
我已经研究过Rails指南和许多其他文档而没有确定原因.如果你想看到所有代码,这是一个公共github链接:https://github.com/allenroulston/testnest.git
class Property < ApplicationRecord
has_many :phones
accepts_nested_attributes_for :phones
end
class Phone < ApplicationRecord
belongs_to :property
end
# the form accepting the data
<%= form_for(property) do |f| %>
<% if property.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(property.errors.count, "error") %> prohibited this property from being saved:</h2>
<ul>
<% property.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %>
<%= f.text_field :name %>
</div>
<div class="field">
<%= …Run Code Online (Sandbox Code Playgroud)