ruby on rails 3 - How to use dynamic scoping with devise and omniauth -
I am upgrading an old app from Rail 3.0 to Rail 4.1 and to establish routes and plans for omniauth There is a problem in Currently the paths look like this:
area "(: locale)", locale: /#{I18n.available_locales.join("|")}/ do devise_for: User, Controller: {Omniauth_callbacks: "users / omniauth_callbacks"} When I run it, I get the following error:
Universal callback under the dynamic section Does not support (RuntimeError) and you have set "/ (: locale) / user" you can bypass' omniauth_callbacks` and manually define routes May include. Here's an example: "User / Author / Provider" Match: Ban: {Provider: / google | Facebook /}, for: "devise / omniauth_callbacks # passthru", as :: Omniauth_authorize, via: [: get, post: match "/ users / athlet :: action / callback", obstructions: {action: / google | Facebook /}, for: "devise / omniauth_callbacks", like :: omniauth_callback, via: [, get, post] I have to manually define routes Have tried, but when I run my test, none of my passages does work, do anybody devise_for these dynamic areas?
correctly knows how to manage routes.rb < "Omniauth_callbacks:" users / omniauth_callbacks "} Scope": Locale ", Locale: / #: / om> {I18n.available_locales.join ("|")} / do devise_for: user, skip: [: omniauth_callbacks]
get answer
Also, Omniauth requires a custom failure block to handle errors during the (example user Cancel):
requires 'devise / omniauth' in # config / initializers / omniauth.rb # See scoping path # while working for the bug: https: // Github.com/spree/spree_social/issues/130 OmniAuth.config.on_failure = Proc.new do | Env | Env ['devise.mapping'] = Devise.mappings [: User] Controller_Name = ActiveSupport :: Inflector.camelize (env ['devise.mapping']. Controllers [: omniauth_callbacks]] Controller_class = ActiveSupport :: Inflector.constantize (" # {Controller_name} Controller ") Administrator_close.action (: Failure) .Coll (NV) End
Comments
Post a Comment