Решение было создать скрытое поле формы с другой кнопкой отправки:
%input#create_another{:name => "create_another", :type => "hidden", :value => 0 }
%a.btn.btn-info#submit_another
Затем используйте javascript для отправки формы:
jQuery(document).ready(function() {
$("#submit_another").click(function() {
$('#create_another').attr('value','1');
console.log($('#create_another').attr('value'));
$(".formtastic").submit();
return true;
});
});
Внутри соответствующего контроллера, в моем случае, контроллер категории:
if params[:create_another].nil?
@create_another = false
else
@create_another = (params[:create_another] == "1")
end
respond_to do |format|
if @category.save
if @create_another
format.html { redirect_to new_restaurant_category_path(@restaurant), notice: I18n.t(:entry_successfully_created, :name => I18n.t(:category_singular)) }