Understanding routes with :path in Ruby on Rails










-1















I'm trying to understand routes in Ruby on Rails and it's very hard to find the right info just by googling. So this is my question: what routes does the following snippet define ?



scope '/admin' do
resource :photo, :only => [:edit], :path => '/d/:domain_name', :domain_name => /[.0-9a-zA-Z-]+/
resource :photo, :only => [:update], :path => '/d/:domain_name/edit', :domain_name => /[.0-9a-zA-Z-]+/

resources :reviews, :only => [:index, :new, :create], :path => '/d/:domain_name/reviews', :domain_name => /[.0-9a-zA-Z-]+/
resources :reviews, :except => [:index, :new, :create] request
end


Thanks a lot !










share|improve this question






















  • Why don't you simply check it with rails routes?

    – Marek Lipka
    Nov 15 '18 at 10:22












  • thanks, but for reasons that are beyond this discussion, I can't run that command

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 10:45















-1















I'm trying to understand routes in Ruby on Rails and it's very hard to find the right info just by googling. So this is my question: what routes does the following snippet define ?



scope '/admin' do
resource :photo, :only => [:edit], :path => '/d/:domain_name', :domain_name => /[.0-9a-zA-Z-]+/
resource :photo, :only => [:update], :path => '/d/:domain_name/edit', :domain_name => /[.0-9a-zA-Z-]+/

resources :reviews, :only => [:index, :new, :create], :path => '/d/:domain_name/reviews', :domain_name => /[.0-9a-zA-Z-]+/
resources :reviews, :except => [:index, :new, :create] request
end


Thanks a lot !










share|improve this question






















  • Why don't you simply check it with rails routes?

    – Marek Lipka
    Nov 15 '18 at 10:22












  • thanks, but for reasons that are beyond this discussion, I can't run that command

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 10:45













-1












-1








-1








I'm trying to understand routes in Ruby on Rails and it's very hard to find the right info just by googling. So this is my question: what routes does the following snippet define ?



scope '/admin' do
resource :photo, :only => [:edit], :path => '/d/:domain_name', :domain_name => /[.0-9a-zA-Z-]+/
resource :photo, :only => [:update], :path => '/d/:domain_name/edit', :domain_name => /[.0-9a-zA-Z-]+/

resources :reviews, :only => [:index, :new, :create], :path => '/d/:domain_name/reviews', :domain_name => /[.0-9a-zA-Z-]+/
resources :reviews, :except => [:index, :new, :create] request
end


Thanks a lot !










share|improve this question














I'm trying to understand routes in Ruby on Rails and it's very hard to find the right info just by googling. So this is my question: what routes does the following snippet define ?



scope '/admin' do
resource :photo, :only => [:edit], :path => '/d/:domain_name', :domain_name => /[.0-9a-zA-Z-]+/
resource :photo, :only => [:update], :path => '/d/:domain_name/edit', :domain_name => /[.0-9a-zA-Z-]+/

resources :reviews, :only => [:index, :new, :create], :path => '/d/:domain_name/reviews', :domain_name => /[.0-9a-zA-Z-]+/
resources :reviews, :except => [:index, :new, :create] request
end


Thanks a lot !







ruby-on-rails ruby






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 10:16









Sorin-Alexandru CristescuSorin-Alexandru Cristescu

297




297












  • Why don't you simply check it with rails routes?

    – Marek Lipka
    Nov 15 '18 at 10:22












  • thanks, but for reasons that are beyond this discussion, I can't run that command

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 10:45

















  • Why don't you simply check it with rails routes?

    – Marek Lipka
    Nov 15 '18 at 10:22












  • thanks, but for reasons that are beyond this discussion, I can't run that command

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 10:45
















Why don't you simply check it with rails routes?

– Marek Lipka
Nov 15 '18 at 10:22






Why don't you simply check it with rails routes?

– Marek Lipka
Nov 15 '18 at 10:22














thanks, but for reasons that are beyond this discussion, I can't run that command

– Sorin-Alexandru Cristescu
Nov 15 '18 at 10:45





thanks, but for reasons that are beyond this discussion, I can't run that command

– Sorin-Alexandru Cristescu
Nov 15 '18 at 10:45












2 Answers
2






active

oldest

votes


















1














This is the output of the command rails routes



 edit_photo GET /admin/d/:domain_name/edit(.:format) photos#edit :domain_name=>/[.0-9a-zA-Z-]+/
photo PATCH /admin/d/:domain_name/edit(.:format) photos#update :domain_name=>/[.0-9a-zA-Z-]+/
PUT /admin/d/:domain_name/edit(.:format) photos#update :domain_name=>/[.0-9a-zA-Z-]+/
reviews GET /admin/d/:domain_name/reviews(.:format) reviews#index :domain_name=>/[.0-9a-zA-Z-]+/
POST /admin/d/:domain_name/reviews(.:format) reviews#create :domain_name=>/[.0-9a-zA-Z-]+/
new_review GET /admin/d/:domain_name/reviews/new(.:format) reviews#new :domain_name=>/[.0-9a-zA-Z-]+/
edit_review GET /admin/reviews/:id/edit(.:format) reviews#edit
review GET /admin/reviews/:id(.:format) reviews#show
PATCH /admin/reviews/:id(.:format) reviews#update
PUT /admin/reviews/:id(.:format) reviews#update
DELETE /admin/reviews/:id(.:format) reviews#destroy





share|improve this answer























  • thank you so much !

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 11:16


















1














run this command and you'll get the results



rails routes | grep /admin



Also, here is the doc for all the options you used: https://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing






share|improve this answer

























  • thanks, but for reasons that are beyond this discussion, I can't run that command

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 10:35











  • I've seen the doc you mentioned, but it's virtually impossible to understand e.g. this one: resources :reviews, :only => [:index, :new, :create], :path => '/d/:domain_name/reviews', :domain_name => /[.0-9a-zA-Z-]+/

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 11:18











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53317118%2funderstanding-routes-with-path-in-ruby-on-rails%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














This is the output of the command rails routes



 edit_photo GET /admin/d/:domain_name/edit(.:format) photos#edit :domain_name=>/[.0-9a-zA-Z-]+/
photo PATCH /admin/d/:domain_name/edit(.:format) photos#update :domain_name=>/[.0-9a-zA-Z-]+/
PUT /admin/d/:domain_name/edit(.:format) photos#update :domain_name=>/[.0-9a-zA-Z-]+/
reviews GET /admin/d/:domain_name/reviews(.:format) reviews#index :domain_name=>/[.0-9a-zA-Z-]+/
POST /admin/d/:domain_name/reviews(.:format) reviews#create :domain_name=>/[.0-9a-zA-Z-]+/
new_review GET /admin/d/:domain_name/reviews/new(.:format) reviews#new :domain_name=>/[.0-9a-zA-Z-]+/
edit_review GET /admin/reviews/:id/edit(.:format) reviews#edit
review GET /admin/reviews/:id(.:format) reviews#show
PATCH /admin/reviews/:id(.:format) reviews#update
PUT /admin/reviews/:id(.:format) reviews#update
DELETE /admin/reviews/:id(.:format) reviews#destroy





share|improve this answer























  • thank you so much !

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 11:16















1














This is the output of the command rails routes



 edit_photo GET /admin/d/:domain_name/edit(.:format) photos#edit :domain_name=>/[.0-9a-zA-Z-]+/
photo PATCH /admin/d/:domain_name/edit(.:format) photos#update :domain_name=>/[.0-9a-zA-Z-]+/
PUT /admin/d/:domain_name/edit(.:format) photos#update :domain_name=>/[.0-9a-zA-Z-]+/
reviews GET /admin/d/:domain_name/reviews(.:format) reviews#index :domain_name=>/[.0-9a-zA-Z-]+/
POST /admin/d/:domain_name/reviews(.:format) reviews#create :domain_name=>/[.0-9a-zA-Z-]+/
new_review GET /admin/d/:domain_name/reviews/new(.:format) reviews#new :domain_name=>/[.0-9a-zA-Z-]+/
edit_review GET /admin/reviews/:id/edit(.:format) reviews#edit
review GET /admin/reviews/:id(.:format) reviews#show
PATCH /admin/reviews/:id(.:format) reviews#update
PUT /admin/reviews/:id(.:format) reviews#update
DELETE /admin/reviews/:id(.:format) reviews#destroy





share|improve this answer























  • thank you so much !

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 11:16













1












1








1







This is the output of the command rails routes



 edit_photo GET /admin/d/:domain_name/edit(.:format) photos#edit :domain_name=>/[.0-9a-zA-Z-]+/
photo PATCH /admin/d/:domain_name/edit(.:format) photos#update :domain_name=>/[.0-9a-zA-Z-]+/
PUT /admin/d/:domain_name/edit(.:format) photos#update :domain_name=>/[.0-9a-zA-Z-]+/
reviews GET /admin/d/:domain_name/reviews(.:format) reviews#index :domain_name=>/[.0-9a-zA-Z-]+/
POST /admin/d/:domain_name/reviews(.:format) reviews#create :domain_name=>/[.0-9a-zA-Z-]+/
new_review GET /admin/d/:domain_name/reviews/new(.:format) reviews#new :domain_name=>/[.0-9a-zA-Z-]+/
edit_review GET /admin/reviews/:id/edit(.:format) reviews#edit
review GET /admin/reviews/:id(.:format) reviews#show
PATCH /admin/reviews/:id(.:format) reviews#update
PUT /admin/reviews/:id(.:format) reviews#update
DELETE /admin/reviews/:id(.:format) reviews#destroy





share|improve this answer













This is the output of the command rails routes



 edit_photo GET /admin/d/:domain_name/edit(.:format) photos#edit :domain_name=>/[.0-9a-zA-Z-]+/
photo PATCH /admin/d/:domain_name/edit(.:format) photos#update :domain_name=>/[.0-9a-zA-Z-]+/
PUT /admin/d/:domain_name/edit(.:format) photos#update :domain_name=>/[.0-9a-zA-Z-]+/
reviews GET /admin/d/:domain_name/reviews(.:format) reviews#index :domain_name=>/[.0-9a-zA-Z-]+/
POST /admin/d/:domain_name/reviews(.:format) reviews#create :domain_name=>/[.0-9a-zA-Z-]+/
new_review GET /admin/d/:domain_name/reviews/new(.:format) reviews#new :domain_name=>/[.0-9a-zA-Z-]+/
edit_review GET /admin/reviews/:id/edit(.:format) reviews#edit
review GET /admin/reviews/:id(.:format) reviews#show
PATCH /admin/reviews/:id(.:format) reviews#update
PUT /admin/reviews/:id(.:format) reviews#update
DELETE /admin/reviews/:id(.:format) reviews#destroy






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 15 '18 at 10:57









Sid BiffiSid Biffi

415715




415715












  • thank you so much !

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 11:16

















  • thank you so much !

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 11:16
















thank you so much !

– Sorin-Alexandru Cristescu
Nov 15 '18 at 11:16





thank you so much !

– Sorin-Alexandru Cristescu
Nov 15 '18 at 11:16













1














run this command and you'll get the results



rails routes | grep /admin



Also, here is the doc for all the options you used: https://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing






share|improve this answer

























  • thanks, but for reasons that are beyond this discussion, I can't run that command

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 10:35











  • I've seen the doc you mentioned, but it's virtually impossible to understand e.g. this one: resources :reviews, :only => [:index, :new, :create], :path => '/d/:domain_name/reviews', :domain_name => /[.0-9a-zA-Z-]+/

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 11:18
















1














run this command and you'll get the results



rails routes | grep /admin



Also, here is the doc for all the options you used: https://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing






share|improve this answer

























  • thanks, but for reasons that are beyond this discussion, I can't run that command

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 10:35











  • I've seen the doc you mentioned, but it's virtually impossible to understand e.g. this one: resources :reviews, :only => [:index, :new, :create], :path => '/d/:domain_name/reviews', :domain_name => /[.0-9a-zA-Z-]+/

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 11:18














1












1








1







run this command and you'll get the results



rails routes | grep /admin



Also, here is the doc for all the options you used: https://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing






share|improve this answer















run this command and you'll get the results



rails routes | grep /admin



Also, here is the doc for all the options you used: https://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 15 '18 at 10:39

























answered Nov 15 '18 at 10:25









RodrigoRodrigo

3,59553170




3,59553170












  • thanks, but for reasons that are beyond this discussion, I can't run that command

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 10:35











  • I've seen the doc you mentioned, but it's virtually impossible to understand e.g. this one: resources :reviews, :only => [:index, :new, :create], :path => '/d/:domain_name/reviews', :domain_name => /[.0-9a-zA-Z-]+/

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 11:18


















  • thanks, but for reasons that are beyond this discussion, I can't run that command

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 10:35











  • I've seen the doc you mentioned, but it's virtually impossible to understand e.g. this one: resources :reviews, :only => [:index, :new, :create], :path => '/d/:domain_name/reviews', :domain_name => /[.0-9a-zA-Z-]+/

    – Sorin-Alexandru Cristescu
    Nov 15 '18 at 11:18

















thanks, but for reasons that are beyond this discussion, I can't run that command

– Sorin-Alexandru Cristescu
Nov 15 '18 at 10:35





thanks, but for reasons that are beyond this discussion, I can't run that command

– Sorin-Alexandru Cristescu
Nov 15 '18 at 10:35













I've seen the doc you mentioned, but it's virtually impossible to understand e.g. this one: resources :reviews, :only => [:index, :new, :create], :path => '/d/:domain_name/reviews', :domain_name => /[.0-9a-zA-Z-]+/

– Sorin-Alexandru Cristescu
Nov 15 '18 at 11:18






I've seen the doc you mentioned, but it's virtually impossible to understand e.g. this one: resources :reviews, :only => [:index, :new, :create], :path => '/d/:domain_name/reviews', :domain_name => /[.0-9a-zA-Z-]+/

– Sorin-Alexandru Cristescu
Nov 15 '18 at 11:18


















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53317118%2funderstanding-routes-with-path-in-ruby-on-rails%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3