I am integrating 2 rails projects using button to link the first project to the second. Now I have this code
<%= form_tag fast_url_for(' ') do %>
<%= button_to AppConfig.app_clockout %>
<% end %>
and my current directory is
/var/www/html/wizTime/wizProject/Source/project_1
but I don't know how can this redirect to the home page of another project. The directory of my second project that I want to integrate is
/var/www/html/project_2
Please give me ideas. Thank you!
As the other commenter said - you can just create a link to the other domain. You should not ever rely on your directory-structure - because when you deploy, that directory structure will very likely be subtly different.
So use the domains instead.
You can even put the domains into environment variables so that you can use different domains (eg localhost:3000
vs localhost:3001
) on your development machine. you'd use them like this:
<%= link_to 'My App', ENV['MY_APP_DOMAIN'] %>
<%= link_to 'My Other App', ENV['MY_OTHER_APP_DOMAIN'] %>
Then google for how to set environment variables on your local machine to set the values.
If you want them to be buttons... then you don't need to use a form. button_to
creates its own form and is used exactly the same way as a link_to eg:
<%= button_to 'My App', ENV['MY_APP_DOMAIN'] %>
<%= button_to 'My Other App', ENV['MY_OTHER_APP_DOMAIN'] %>
However... you really don't need to use a button-to if you are just doing a GET
for a URL like this...
(you use buttons when you need to POST data eg POSTing form data to a create action)
You can just pass in a CSS-class and style the link-to to look as though it were a button.
eg using Bootstrap classes:
<%= link_to 'My App', ENV['MY_APP_DOMAIN'], class: 'btn btn-success' %>
<%= link_to 'My Other App', ENV['MY_OTHER_APP_DOMAIN'], class: 'btn btn-danger' %>
OR similar.