My question: Is there a way for Rails to know if it is running under Apache 
or under Webrick?


Background:
I run my Rails website in two environments

1) Under webrick
2) Under Apache

I am "successfully" sending email when I want my registering user to 
confirm the user's identity.

Devise massages 
....gems/devise-4.3.0/app/views/devise/mailer/confirmation_instructions.html.erb
<p>Welcome <%= @email %>!</p>

<p>You can confirm your account email through the link below:</p>

<p><%= link_to 'Confirm my account', confirmation_url(@resource, 
confirmation_token: @token) %></p>

So I was very puzzled (and spent a couple of hours investigating code) why 
all the emails had a confirmation link similar to
http://localhost:3000/users/confirmation?confirmation_token=wZ4QQPTH2dHi84ku9z2ms
 
<http://localhost:3000/users/confirmation?confirmation_token=wZ4PPTH2dHi84ku9z2ms>

That is, why is Devise referring to localhost:3000 even when I'm running 
under Apache.

The code in 
~/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise-4.3.0/lib/devise/controllers/url_helpers.rb
 
is rather complex ... Well above my head.

So I said to myself, "Self, surely someone else has had this problem."  
Yup.  They have.

I found the answer in 
https://groups.google.com/forum/#!topic/plataformatec-devise/0NN5-Zhyb6g.

But I still don't know of a robust way to test the environment: Webrick or 
Apache



-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f7cb6a6d-00f5-409b-a66a-41acd5e7aed5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to