真正的堆栈溢出......这是我第一次从应用程序发送电子邮件。
从表格:
<%= form_tag request_path do %>
<%= text_field_tag :email, nil, placeholder: 'Find...', class: 'ui-corner-all' %>
<%= submit_tag "Send request", class: 'button' %>
<% end %>
给控制器:
def request
user_email = params[:email]
UserMailer.request(user_email).deliver
#flash[:notice] = "We'll let #{@user[:name]} know!"
end
通过邮件:
def request(email)
@url = "http://mysite.herokuapp.com/"
mail to: email,
subject: "#{first_name(current_user)} would like to say hi!"
end
我在控制台中得到了这个:
SystemStackError (stack level too deep):
actionpack (3.2.12) lib/action_dispatch/middleware/reloader.rb:70
Rendered C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.0ms)
Rendered C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.0ms)
Rendered C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (31.2ms)
谷歌让我失望了,所以希望这里有人能提供线索。