繁体   English   中英

Rails如何修复丢失的手机模板?

[英]Rails How to fix Missing mobile template?

我正在尝试在移动设备上更新用户信息,但Rails日志显示:

有人知道为什么在移动模式下会发生这种情况吗?

缺少模板用户/更新,带有{:locale => [:: en“] 、: formats => [:mobile] 、: handlers => [:erb,:builder,:coffee]}的应用程序/更新。 在以下位置搜索:

def update
    @user = User.find(params[:id])
    respond_to do |format|
      format.html do
        @states = State.all
        @cities = City.where('state_id = ?', State.first.id)
        if @user.update_attributes(params[:user])
          redirect_to(action: :edit, id: @user, only_path: true, format: :html)
          flash[:notice] = 'updated'

        else
          render :edit
        end
      end
      format.json do
        @user.update_attributes(params[:user])
        render nothing: true
      end
    end
  end

你有format.html doformat.json do ,但你没有format.mobile do块。

由于未执行html和json块,因此代码会掉线,并且任何操作的默认设置都是使用操作名称来呈现格式,因此您处于操作update因此Rails默认情况下会查找视图update.html.erbupdate.html.haml

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM