簡體   English   中英

自動生成的苗條設計錯誤

[英]Devise error on auto-generated slim

當我使用devise's編輯用戶注冊slim文件時,出現此錯誤:

Started GET "/users/edit" for 127.0.0.1 at 2014-04-30 00:28:39 +0530
Processing by Devise::RegistrationsController#edit as HTML
User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 4 ORDER BY "users"."id" ASC LIMIT 1
Rendered devise/registrations/edit.html.slim within layouts/application (5.0ms)
Completed 500 Internal Server Error in 9ms

ActionView::Template::Error (Multiple your attributes specified):
temple (0.6.7) lib/temple/html/attribute_merger.rb:15:in `block in on_html_attrs'
temple (0.6.7) lib/temple/html/attribute_merger.rb:12:in `each'
temple (0.6.7) lib/temple/html/attribute_merger.rb:12:in `on_html_attrs'
(eval):7:in `dispatcher'
temple (0.6.7) lib/temple/mixins/dispatcher.rb:49:in `compile'
temple (0.6.7) lib/temple/html/dispatcher.rb:26:in `on_html_tag'
(eval):17:in `dispatcher'
temple (0.6.7) lib/temple/mixins/dispatcher.rb:49:in `compile'
temple (0.6.7) lib/temple/mixins/dispatcher.rb:7:in `block in on_multi'
emple (0.6.7) lib/temple/mixins/dispatcher.rb:7:in `each'
temple (0.6.7) lib/temple/mixins/dispatcher.rb:7:in `on_multi'
(eval):32:in `dispatcher'
temple (0.6.7) lib/temple/mixins/dispatcher.rb:49:in `compile'
temple (0.6.7) lib/temple/html/dispatcher.rb:27:in `on_html_tag'

用戶注冊瘦文件為:

h2
 | Edit #{resource_name.to_s.humanize}
= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
    = devise_error_messages!
    div
        = f.label :email
        br
        = f.email_field :email, autofocus: true
    - if devise_mapping.confirmable? && resource.pending_reconfirmation?
    div
        | Currently waiting confirmation for: #{resource.unconfirmed_email}
    div
        = f.label :password
        i (leave blank if you dont want to change it)
        br
        = f.password_field :password, autocomplete: "off"
    div
        = f.label :password_confirmation
        br
        = f.password_field :password_confirmation, autocomplete: "off"
    div
        = f.label :current_password
        i (we need your current password to confirm your changes)
        br
        = f.password_field :current_password, autocomplete: "off"
    div= f.submit "Update"
h3 Cancel my account
p
    | Unhappy? #{button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete}
= link_to "Back", :back

如何解決這個錯誤?

注意 :此slim文件是自動生成的。

解決了。

錯誤在此行之后:

- if devise_mapping.confirmable? && resource.pending_reconfirmation?

div's沒有縮進,因此if塊不會結束,因此會出錯。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM