lib/rodauth/rails/feature.rb in rodauth-rails-0.4.0 vs lib/rodauth/rails/feature.rb in rodauth-rails-0.4.1

- old
+ new

@@ -60,12 +60,16 @@ email.deliver_now end # Calls the Rails renderer, returning nil if a template is missing. def rails_render(*args) - rails_controller_instance.render_to_string(*args) - rescue ActionView::MissingTemplate - nil + return if only_json? + + begin + rails_controller_instance.render_to_string(*args) + rescue ActionView::MissingTemplate + nil + end end # Hidden tag with Rails CSRF token inserted into Rodauth templates. def rails_csrf_tag %(<input type="hidden" name="#{rails_csrf_param}" value="#{rails_csrf_token}">)