I need to make an API with Devise authentication. API is better to implement with ActionController::Metal
descendant, but Devise relies on before_filter
method which is only defined in ActionController::Base
descendants.
Any solutions?
Simply include some helpers in your ApplicationController
Example:
class ApplicationController < ActionController::Metal
include AbstractController::Callbacks # This adds before_filter
include Devise::Controllers::Helpers # This adds current_user
...
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.