Существует, вероятно, несколько способов сделать это. Прием, который мы используем:
#!/bin/bash
until [ "`curl --silent --show-error --connect-timeout 1 -I http://localhost:8080 | grep 'Coyote'`" != "" ];
do
echo --- sleeping for 10 seconds
sleep 10
done
echo Tomcat is ready!
Hope это помогает!
Как пояснил другой пользователь, отвечая на мой другой вопрос , вот что я искал:
form_for @user, :url => { :action => :create, :type => @type }
... который сохраняет параметр : введите
в каждое новое действие рендеринга (при условии, что оно правильно определено в моем контроллере).
Это можно сделать двумя способами.
Либо добавьте скрытое поле, либо дополнительный параметр в form_for
Добавление скрытого поля в вашу форму, содержащего именованный тип, и установите его равным params [: type], это сохранит тип при визуализации в случае сбоя проверки.
Просмотреть код:
<% form_for @user do |f| %>
...
<%= hidden_field_tag :type, params[:type] %>
<%end%>
Добавление дополнительного параметра в форму:
<% form_for @user, create_user_path(@user, :type => params[:type]) %>
...
<%end%>
Любой из них будет делать то, что вы хотите.
Extract for Rails Guides
Using render with :action is a frequent source of confusion for Rails newcomers. The specified action is used to determine which view to render, but Rails does not run any of the code for that action in the controller
I believe your new?type=client
is used to setup some kind of variable in your new action?
And the variable is later used in your new.html.erb view?
Then you need to change a little bit your create action like this:
else
# add code here to setup any variable for type = client
# and which will be used in your view
render :action => 'new'
end
end
You could always force it by:
params[:type] ||= "client"
in your new action in your controller. If type is not set then it will default to client. The URL will not show this however.