Understanding routes with :path in Ruby on Rails
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
add a comment |
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
Why don't you simply check it withrails 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
add a comment |
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
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
ruby-on-rails ruby
asked Nov 15 '18 at 10:16
Sorin-Alexandru CristescuSorin-Alexandru Cristescu
297
297
Why don't you simply check it withrails 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
add a comment |
Why don't you simply check it withrails 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
add a comment |
2 Answers
2
active
oldest
votes
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
thank you so much !
– Sorin-Alexandru Cristescu
Nov 15 '18 at 11:16
add a comment |
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
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
thank you so much !
– Sorin-Alexandru Cristescu
Nov 15 '18 at 11:16
add a comment |
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
thank you so much !
– Sorin-Alexandru Cristescu
Nov 15 '18 at 11:16
add a comment |
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
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
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
add a comment |
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
add a comment |
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
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
add a comment |
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
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
add a comment |
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
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
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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