Created
November 16, 2018 11:08
-
-
Save abhianair/0614e5649701a5f78463c422aae596c7 to your computer and use it in GitHub Desktop.
Enter Subdomain name inside input field and redirect to its domain if the subdomain present.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def proceed | |
@domain_from_form = params[:search][:q] | |
@domain_search = User.pluck(:subdomain) | |
@domain_present = @domain_search.include? @domain_from_form | |
if @domain_present == true | |
redirect_to "http://#{@domain_from_form}.lvh.me:3000/accounts/sign_in" | |
else | |
redirect_to resub_index_path | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Enter the Subdomain</h1> | |
<%= form_for :search, :url => { :method => :get, :action => :proceed } do |f| %> | |
<%= f.label :q, "Enter the Subdomain" %> | |
<%= f.text_field :q %> | |
<%= f.submit "Proceed" %> | |
<% end %> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment