lib/rodauth/rails/feature.rb in rodauth-rails-0.8.2 vs lib/rodauth/rails/feature.rb in rodauth-rails-0.9.0
- old
+ new
@@ -190,9 +190,17 @@
def rails_api_controller?
defined?(ActionController::API) && rails_controller <= ActionController::API
end
+ def rails_controller
+ if only_json? && Rodauth::Rails.api_only?
+ ActionController::API
+ else
+ ActionController::Base
+ end
+ end
+
# ActionMailer subclass for correct email delivering.
class Mailer < ActionMailer::Base
def create_email(**options)
mail(**options)
end