请求此路线时出现此错误:direct_appointment_url(@appointment.uuid, :subdomain => @user.name)
direct_appointment_url(@appointment.uuid, :subdomain => @user.name)
TypeError: can't convert Array to String
from ...rvm/gems/ruby-1.9.3-p362@example/gems/actionpack-3.2.12/lib/action_dispatch/http/url.rb:55:in `match'
路线定义为:get "/appointment/:uuid" => "schedule#appointment", as: "direct_appointment"
传入路由匹配器的两个变量的值是:
appointment.uuid => "a52aff80-5b83-0130-987f-0026080ebf68"
和
@user.name => "example"
更多背景:
ActionView::Template::Error (can't convert Array to String):
13: Message: <%= @appointment.client_message %>
14: <% end %>
15:
16: View online: <%= direct_appointment_url(@appointment.uuid, :subdomain => @user.name) %>
17:
18: To see your latest appointments, login at: <%= @login_url %>
19: Your username is: <%= @user.email %>
app/views/user_mailer/new_appointment_email.text.erb:16:in `_app_views_user_mailer_new_appointment_email_text_erb__686277782469675039_70200502266100'
app/mailers/user_mailer.rb:13:in `block in new_appointment_email'
app/mailers/user_mailer.rb:12:in `new_appointment_email'
app/controllers/appointments_controller.rb:43:in `block in create'
app/controllers/appointments_controller.rb:42:in `create'