ruby on rails - I do not know Routing -


i making web application using ruby on rails now. however, may in trouble. routing when show action invoked article (articles) displayed hoge.com/articles/ (article id). want /hoge.com/username/ (article id), can not quite.

routes.rb

devise_for :users, controllers: { omniauth_callbacks: 'omniauth_callbacks' } devise_scope :user   resources :articles   '/:username', controller: 'users', action: 'show'   '/users/sign_out', controller: 'devise/sessions', action: 'destroy'   'users/auth/:provider/disconnect', controller: 'omniauth_disconnects', action: 'update' end post 'user_invitation_beta_release/new' 'static/welcome' root to: 'root#index' resources :items resources :contents resources :articles   resources :contents, only: [:create, :destroy, :change_order]     resources :items, only: [:create, :destroy]   end end match "*path" => "application#handle_404", via: :all 

please tell me

try this:

get '/:username/:article_id', controller: 'articles', action: 'show' 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -