我在user.model中添加了这个函数
def is_federated?(session)
session[:federatedIdHeader].present?
end
我的表单.html.haml文件是这样的,我试图编辑用户,如果它通过在第7行传递会话联合,这基本上是在另一个repo中,我使用它作为一个gem
.user-edit-form
= simple_form_for(editable_user,html: { autocomplete: "off" }) do |f|
%section
%header
%h3
= precede "User Information" do
-if editable_user.is_federated?(session)
= link_to "Change Password",main_app.try(:new_password_path)
.inputs
= f.input :needs_setup,as: :hidden,input_html: { value: false }
= f.input :name,required: true
= f.input :email,disabled: true
= f.input :phone,label: "Phone Number"
= f.input :title
- if editable_user_is_authorized?(editable_user)
%section
%header
%h3
= precede "Company Information" do
%small (Shared by all users in your company)
.inputs
= f.fields_for :account do |a|
= a.input :name,required: true
= a.input :url,label: "Web Address",required: true
.actions
= f.button :submit, "Save Profile", class: "button little green"
我在部署时收到此错误
users/edit/_form.html.haml:7: syntax error, unexpected ')' ));}\n", 0, false);if
editable_user.is_federated?(session)
/edit/_form.html.haml:9: syntax error, unexpected ')', expecting keyword_end ));}\n", 0,
false);end;
如何让它发挥作用
1条答案
按热度按时间nsc4cvqm1#
这应该可以解决你的问题了..问题是:打开
precede
块后的行,块内容需要缩进以位于块内。我希望你能理解。