小编C d*_*VII的帖子

没有路由匹配[PATCH]"/ users/1/edit"

我是rails的新手,目前在使用rails教程时遇到问题.我在示例应用程序的第10章.我检查确保资源:用户包含在routes.rb配置文件中,但我仍然想出这个错误 - 请帮助!

No route matches [PATCH] "/users/1/edit". 
Run Code Online (Sandbox Code Playgroud)

运行rails路由收益率

   Prefix Verb   URI Pattern               Controller#Action
     root GET    /                         static_pages#home
     help GET    /help(.:format)           static_pages#help
    about GET    /about(.:format)          static_pages#about
  contact GET    /contact(.:format)        static_pages#contact
   signup GET    /signup(.:format)         users#new
         POST   /signup(.:format)         users#create
    login GET    /login(.:format)          sessions#new
         POST   /login(.:format)          sessions#create
logout DELETE /logout(.:format)         sessions#destroy
    users GET    /users(.:format)          users#index
         POST   /users(.:format)          users#create
 new_user GET    /users/new(.:format)      users#new
edit_user GET    /users/:id/edit(.:format) users#edit
     user GET    /users/:id(.:format)      users#show
        PATCH  /users/:id(.:format)      users#update
          PUT    /users/:id(.:format)      users#update
       DELETE /users/:id(.:format)      users#destroy
Run Code Online (Sandbox Code Playgroud)

我的文件配置如下:

配置/ routes.rb中

Rails.application.routes.draw …
Run Code Online (Sandbox Code Playgroud)

routing ruby-on-rails railstutorial.org

2
推荐指数
1
解决办法
3079
查看次数

link_to中的Ruby三元组

我的基本问题是如何使用三元组将其转换为一行代码?

 <% if tip_off %>
  <%= link_to "Dead Man's Snitch", [:homepage], class: "topbar-brand-tip-off", rel: "home" %>
<% else %>
  <%= link_to "Dead Man's Snitch", [:homepage], class: "topbar-brand", rel: "home" %>
<% end %>
Run Code Online (Sandbox Code Playgroud)

我正在做的就是在特定条件下更改类名.

ruby refactoring ruby-on-rails erb

1
推荐指数
1
解决办法
287
查看次数