devise:nil:NilClass的未定义方法`router_name'

时间:2019-04-02 00:42:57

标签: ruby-on-rails devise

我遇到错误

undefined method `router_name' for nil:NilClass

现在在我的应用首页上正常运行

</div>
      <div class="modal-body">
        <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), :html => {:id => 'registration'}) do |f| %>
          <%= f.error_notification %>
          <div class="form-inputs" style="margin: 13px">
            <%= f.input :email, required: true, autofocus: true, :input_html => {:id => 'email_new_user', :autocomplete => :on} %>

从控制台:

Processing by WelcomeController#homepage as HTML
  Parameters: {"locale"=>"en"}
  User Load (4449.7ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", "bb789076-afd7-43e9-a91c-37ace112183b"], ["LIMIT", 1]]
   (44899.5ms)  SELECT "distribs"."city" FROM "distribs" WHERE "distribs"."position" = $1  [["position", "Pilote"]]
Completed 500 Internal Server Error in 103073ms (ActiveRecord: 96629.8ms)




NameError (uninitialized constant Todo::UserId):

app/controllers/welcome_controller.rb:25:in `homepage'

欢迎控制器的第25行是:

  @todos = Todo.where(user_id: current_user.id)

似乎应用程序中需要user_id/current_user.id的任何页面/模块都无法正常工作。

我没有对设计组件进行任何更改。我正在使用RubyMine。

有人在simple_form声明中看到什么地方了吗?

0 个答案:

没有答案