- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
所以我在顶部有一个 Bootstrap 导航栏。
我想链接到当前用户的编辑路径,但我总是得到错误:
ActionController::RoutingError at /blog
No route matches {:action=>"edit", :controller=>"users"}
这就是我目前正在尝试的:
<% if current_user %> <--! user logged in? -->
<% @user ||= current_user %>
<%= link_to 'Settings', edit_user_path %>
<% end %>
我在/user/1/页面上没有这个错误,但我在其他任何地方都有。
也试过这个,但没有帮助:
def edit
if params[:id]
@user = User.find(params[:id])
else
@user = current_user
end
end
最佳答案
试试这个,
<%= link_to 'Settings', edit_user_path(current_user) %>
关于ruby-on-rails - 路由到 current_user 路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15407714/
Devise自述文件没有提及任何关于 @current_user 和 I don't see any reference to it in Devise's source code 的内容- 也不在我
我关注this post 。在我看来: - if current_user - if current_user.present? - if current_user.exists? - if curr
我关注this post 。在我看来: - if current_user - if current_user.present? - if current_user.exists? - if curr
刚开始使用我的应用程序身份验证设计开发,但是在从模型访问 current_user 时遇到了麻烦。我从 Controller 访问它没有问题。 对于我的场景,我需要获取当前用户 ID 以跟踪谁编辑了博
我在我的flask应用程序中使用flask_login扩展名登录用户。如您所知,此扩展名具有存储current_user的变量。该代码可以正常运行,除非要进行测试。 当我测试代码(使用unittest
我想用 Swift 为 OS X 应用程序定义一个变量。 但我总是收到此错误:“CURRENT_USER 的重新声明无效”。 这是我写的: var CURRENT_USER: Firebase? 我也
例如我有一个用户和一个地址,关系如下: class User < ActiveRecord::Base devise :database_authenticatable, :registerabl
我正在按照 teamtreehouse.com guide 构建我的第一个 Ruby on Rails 应用程序(ruby 2.0.0p353) . 我正在使用设计 3.2.2 devise在 app
我对 How to customize Devise to store more informations in the session? 有同样的问题 当我使用 current_user和 user
要为我的问题提供更多背景信息,请参阅此 Github 问题 - https://github.com/getsentry/raven-ruby/issues/144 我正在使用 raven这是一个错误
鉴于以下模型: Room (id, title) RoomMembers (id, room_id) RoomFeed, also an observer 当房间标题更新时,我想创建一个 RoomFe
我在 Rails 应用程序的 lib 目录中创建了一个类。该类需要访问 Devise 的 current_user。 我还应该指出,这个 lib 类经常从模型代码中访问,因此不能将 current_u
在 Flask 中,我想了解如何创建一个行为类似于 current_user 的函数,因为它在任何地方( Controller 和 View )都可用,但我很难真正知道它是什么搜索以找到答案。 我能找
我目前正在阅读 RoR 教程(http://railstutorial.org/chapters/sign-in-sign-out#sec:signin_success 是相关部分),这似乎相当不错,
我在 rails5 中使用 Active Model Serializer 0.10.7 我想知道如何在序列化程序中访问设计 current_user。 current_user 应该默认设置为范围。
如何将参数传递给我的 current_user 重定向? # SessionHelper.rb def current_user if(user_id = session[:user_id]
默认列值存在问题... 以下作品: alter table chartdata.reddit_comments add modified_datetime timestamp default now(
我使用以下命令检查 PostgreSQL 数据库中用户的组或角色, select rolname from pg_authid where pg_has_role('some_username', r
我正在使用系统测试来验证以下流程是否按用户预期的方式工作: 在表格中注册 登录 访问帐户页面 更新账户信息 但是,我在创建用户后遇到错误: Puma caught this error: Couldn
我正在使用 Flask-Login,我想通过调用 current_user.is_authenticated() 检查用户是否已登录。 我的 Flask 应用程序被组织成蓝图,其中包含一个主要的 __
我是一名优秀的程序员,十分优秀!