Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 在Rail 3中使用action mailer时没有完整的URL?_Ruby_Ruby On Rails 3_Email - Fatal编程技术网

Ruby 在Rail 3中使用action mailer时没有完整的URL?

Ruby 在Rail 3中使用action mailer时没有完整的URL?,ruby,ruby-on-rails-3,email,Ruby,Ruby On Rails 3,Email,我正在尝试使用Ruby on Rails在我的应用程序中实现重置密码功能。我正在使用action mailer发送指向用户电子邮件的链接。电子邮件通过链接发送给用户,但当用户单击该链接时,完整URL不会出现(即-“localhost:3000/homes/resetpass”)。仅“/homes/resetpass”即将到来。请检查我的以下代码并帮助我解决此问题 视图/user\u mailer/registration\u confirmation.html.erb 您需要使用而不是链接到。链

我正在尝试使用Ruby on Rails在我的应用程序中实现重置密码功能。我正在使用action mailer发送指向用户电子邮件的链接。电子邮件通过链接发送给用户,但当用户单击该链接时,完整URL不会出现(即-“localhost:3000/homes/resetpass”)。仅“/homes/resetpass”即将到来。请检查我的以下代码并帮助我解决此问题

视图/user\u mailer/registration\u confirmation.html.erb 您需要使用而不是链接到。链接页面描述了如何以及为什么

<p><%= @users.first_name %>,</p>

<p>Thank you for registering!</p>

<p>Edit Your Password <%= link_to "Click Here",homes_resetpass_path(:id => @users.id ),:host => "localhost:3000" %></p>
class UserMailer < ActionMailer::Base
  default from: "rajatpradhan474@gmail.com"
  def registration_confirmation(user)  
  @users = user  
  mail(:to => user.email, :subject => "Registered")  
end  
end
ActionMailer::Base.smtp_settings = {  
  :address              => "smtp.gmail.com",  
  :port                 => 587,  
  :domain               => "gmail.com",  
  :user_name            => "rajatpradhan474@gmail.com",  
  :password             => "**********",  
  :authentication       => "plain",  
  :enable_starttls_auto => true  
} 
ActionMailer::Base.default_url_options[:host] = "localhost:3000"