I came across this while trying to use the gem of the Versist version for custom version authentication strategies (Rails 5). Here is my solution to configure it without the need for a special controller:
/config/initializers/inflections.rb gets an inflector, so the API will not display as Api. its pleasant
ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.acronym 'API' end
routes.rb
api_version(:module => "API::V1",:path => {:value => "api/v1"}) do devise_for :users, :as => :fancy,
It will also allow you to add your own authentication strategy and do great with solutions like 4TRABE remote authentication http://4trabes.com/2012/10/31/remote-authentication-with-devise/ Now you can have a nice version of external authentication external API. Of course, we can add a custom controller, but there is no need to interrupt the version number from the area.
Just remember that since you changed the scope, you will need to reference it this way when you register it with the boss. i.e. The /devise.rb initializers end up like this:
config.warden do |manager| manager.strategies.add(:remote_authenticatable, Devise::Strategies::RemoteAuthenticatable) manager.default_strategies(:scope => :fancy_user).unshift :remote_authenticatable end config.add_module :remote_authenticatable, :controller => :sessions, :route => { :session => :routes }
Hope this helps someone enjoy ^ _ ^
source share