Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 没有与自定义路由匹配的路由_Ruby On Rails_Ruby On Rails 3 - Fatal编程技术网

Ruby on rails 没有与自定义路由匹配的路由

Ruby on rails 没有与自定义路由匹配的路由,ruby-on-rails,ruby-on-rails-3,Ruby On Rails,Ruby On Rails 3,我正在为我的用户配置文件配置一个名为profile.html.erb的自定义页面 我正在吃晚饭 No route matches {:action=>"profile", :controller=>"users"} 在路线方面,我有: resources :users do member do get :profile end end 我的用户\u controller.rb def profile @user = User.find(params[:id])

我正在为我的用户配置文件配置一个名为profile.html.erb的自定义页面

我正在吃晚饭

No route matches {:action=>"profile", :controller=>"users"}
在路线方面,我有:

resources :users do
  member do
    get :profile
  end
end
我的用户\u controller.rb

def profile
  @user = User.find(params[:id])
  render 'profile'
end
此行出现错误:

<li><%= link_to "Profile", profile_user_path %></li>
profile.html.erb正在以我可以访问的方式工作

http://localhost:3000/users/1/profile

由于这是一个成员路由,因此需要提供成员

正在做


如果不向用户提供,则将是一个集合的路由。

由于这是一个成员路由,您需要提供该成员

正在做

如果不向用户提供,这将是一个集合的路由

http://localhost:3000/users/1/profile