Home How to keep the scope as a variable value in rails routing?
Reply: 0

How to keep the scope as a variable value in rails routing?

vidur punj
1#
vidur punj Published in 2017-11-14 08:52:20Z

I am use Rails 5.1 and Ruby 2.4.1 can I keep the scope as a variable value in routes.rb file.

scope :url do
    resources :users
end

is their a way to keep the url as a variable value. so the routes are produced like:

edit_user GET    /:url/users/:id/edit(.:format)          users#edit
user GET    /:url/users/:id(.:format)               users#show
PATCH  /:url/users/:id(.:format)               users#update
PUT    /:url/users/:id(.:format)               users#update
DELETE /:url/users/:id(.:format)               users#destroy

not like:

                       GET    /url/users/new(.:format)               users#new
             edit_user GET    /url/users/:id/edit(.:format)          users#edit
                  user GET    /url/users/:id(.:format)               users#show
                       PATCH  /url/users/:id(.:format)               users#update
                       PUT    /url/users/:id(.:format)               users#update
                       DELETE /url/users/:id(.:format)               users#destroy

Thanks in advance.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.303832 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO