http://localhost:3000/static_pages/2
↑のアドレスに接続できるリンクを作りたいですstatic_pagesはController
2はユーザーIDで、IDが1のときは1を代入するような形にしたいです
%li= link_to "Home", static_pages_path
static_pages_pathをどのように変えればいいかわかりません。ヒントでいいので教えてください。
routes.rbにはresources :static_pagesと記述しています。
ルートは以下の通りです
ruby
1 $ rake routes 2 Prefix Verb URI Pattern Controller#Action 3 password_resets_new GET /password_resets/new(.:format) password_resets#new 4 password_resets_edit GET /password_resets/edit(.:format) password_resets#edit 5 sessions_new GET /sessions/new(.:format) sessions#new 6 user_new GET /user/new(.:format) user#new 7 root GET / static_pages#home 8 help GET /help(.:format) static_pages#help 9 about GET /about(.:format) static_pages#about 10 contact GET /contact(.:format) static_pages#contact 11 signup GET /signup(.:format) users#new 12 login GET /login(.:format) sessions#new 13 POST /login(.:format) sessions#create 14 logout DELETE /logout(.:format) sessions#destroy 15 users GET /users(.:format) users#index 16 POST /users(.:format) users#create 17 new_user GET /users/new(.:format) users#new 18 edit_user GET /users/:id/edit(.:format) users#edit 19 user GET /users/:id(.:format) users#show 20 PATCH /users/:id(.:format) users#update 21 PUT /users/:id(.:format) users#update 22 DELETE /users/:id(.:format) users#destroy 23 static_pages GET /static_pages(.:format) static_pages#index 24 POST /static_pages(.:format) static_pages#create 25 new_static_page GET /static_pages/new(.:format) static_pages#new 26 edit_static_page GET /static_pages/:id/edit(.:format) static_pages#edit 27 static_page GET /static_pages/:id(.:format) static_pages#show 28 PATCH /static_pages/:id(.:format) static_pages#update 29 PUT /static_pages/:id(.:format) static_pages#update 30 DELETE /static_pages/:id(.:format) static_pages#destroy 31edit_account_activation GET /account_activations/:id/edit(.:format) account_activations#edit 32 password_resets POST /password_resets(.:format) password_resets#create 33 new_password_reset GET /password_resets/new(.:format) password_resets#new 34 edit_password_reset GET /password_resets/:id/edit(.:format) password_resets#edit 35 password_reset PATCH /password_resets/:id(.:format) password_resets#update 36 PUT /password_resets/:id(.:format) password_resets#update 37 microposts POST /microposts(.:format) microposts#create 38 micropost DELETE /microposts/:id(.:format) microposts#destroy
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/10/01 22:02
2016/10/01 23:15
2016/10/01 23:29