Rendering Error with Devise and Mobylette

不羁岁月 提交于 2021-02-08 06:51:20

问题


I am using Mobylette with Devise on my Rails 4 app.

When I try to sign up, sign in, or reset my password on my mobile device I get this error:

ActionController::MissingRenderer (No renderer defined for format: mobile)

Has anyone else had this issue?

I've tried setting up a fallback chain

mobylette_config do |config|
  config[:fallback_chains] = {
    mobile: [:mobile, :html]
  }
end

and adding this to the devise initializer

config.navigational_formats = ['*/*', :html, :mobile]

But continue to get the renderer error.

Any recommendations would be awesome, still new to mobile formatting.


回答1:


Please modify

config/initializers/devise.rb

config.navigational_formats = [:"*/*", "*/*", :html, :mobile]



回答2:


Solved the issue with the following..

created an initializer and added this:

ActionController::Responder.class_eval do
  alias :to_mobile :to_html
end

along with Preshant4020's suggestion

config.navigational_formats = [:"*/*", "*/*", :html, :mobile]

in the devise initialize and got it to work with no issues.



来源:https://stackoverflow.com/questions/30910104/rendering-error-with-devise-and-mobylette

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!