Ruby on rails 使用Deviate按id编辑、删除用户
我正在建立一个管理面板,在那里我创建了一个页面来列出注册的用户。我需要创建一个链接来编辑和删除一个id用户。我不知道Desive是否允许这样的操作,但可能会覆盖原始代码 以下是我在视图上的代码(当然不起作用):Ruby on rails 使用Deviate按id编辑、删除用户,ruby-on-rails,devise,edit,Ruby On Rails,Devise,Edit,我正在建立一个管理面板,在那里我创建了一个页面来列出注册的用户。我需要创建一个链接来编辑和删除一个id用户。我不知道Desive是否允许这样的操作,但可能会覆盖原始代码 以下是我在视图上的代码(当然不起作用): %h2用户 %桌子。桌子。桌子条纹 %泰德 %tr %第名 %电子邮件 %用户类型 %th状态 %编辑 %删除 %t车身 -@users.each do | user| %tr %th=user.name %th=user.email -如果user.user_type==1 %th=u
%h2用户
%桌子。桌子。桌子条纹
%泰德
%tr
%第名
%电子邮件
%用户类型
%th状态
%编辑
%删除
%t车身
-@users.each do | user|
%tr
%th=user.name
%th=user.email
-如果user.user_type==1
%th=user.user\u type=“用户”
-否则
%th=user.user\u type=“Admin”
-如果user.status==1
%th=user.status=“活动”
-否则
%th=user.status=“非活动”
%th=链接到“”。html\u安全,编辑用户注册路径(当前用户),:方法=>:放置
%th=链接到“.html\u安全,注册路径(用户),:确认=>“确定吗?”,:方法=>:删除
我认为这篇文章可以帮助你。我认为这篇文章可以帮助你。
%h2 Users
%table.table.table-striped
%thead
%tr
%th Name
%th Email
%th User Type
%th Status
%th Edit
%th Delete
%tbody
- @users.each do |user|
%tr
%th= user.name
%th= user.email
- if user.user_type == 1
%th= user.user_type = "User"
- else
%th= user.user_type = "Admin"
- if user.status == 1
%th= user.status = "Active"
- else
%th= user.status = "Inactive"
%th= link_to "<i class='glyphicon glyphicon-edit'></i>".html_safe, edit_user_registration_path(current_user), :method => :put
%th= link_to "<i class='glyphicon glyphicon-trash'></i>".html_safe, registration_path(user), :confirm => "Are you sure?", :method => :delete