# Livello ulteriore nel path

**URL:** <https://www.ruby-forum.com/t/livello-ulteriore-nel-path/216138>\
**Category:** IT\
**Created:** [January 26, 2012, 2:07pm UTC](https://www.ruby-forum.com/t/livello-ulteriore-nel-path/216138 "2012-01-26T14:07:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 26, 2012, 2:07pm UTC](https://www.ruby-forum.com/t/livello-ulteriore-nel-path/216138/1 "2012-01-26T14:07:34Z")

</div>

E’ possibile inserire nel path un livello (qui ‘service\_1’) per  
selezionare il servizio desiderato (nel caso io abbia piu’ applicazioni  
rails)?  
www.mioserver.it/service\_1/controller\_name/action\_name

Come si gestisce?

Grazie mille,  
ciao

Iwan

---

<div class="post-metadata">

**Author:** ![1w4n](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/1/65b543/32.png) [@1w4n](https://www.ruby-forum.com/u/1w4n)\
**Post date:** [January 26, 2012, 2:22pm UTC](https://www.ruby-forum.com/t/livello-ulteriore-nel-path/216138/2 "2012-01-26T14:22:40Z")

</div>

Mettere il resource in un namespace?

namespace :service do  
resource :controller\_name  
end

vedi

> **[Rails Routing from the Outside In — Ruby on Rails Guides](https://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing)**
>
> Rails Routing from the Outside InThis guide covers the user-facing features of Rails routing.After reading this guide, you will know: How to interpret the code in config/routes.rb. How to construct your own routes, using either the preferred...

P.S.

Parlo del routes.rb

---

<div class="post-metadata">

**Author:** ![1w4n](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/1/65b543/32.png) [@1w4n](https://www.ruby-forum.com/u/1w4n)\
**Post date:** [January 26, 2012, 2:27pm UTC](https://www.ruby-forum.com/t/livello-ulteriore-nel-path/216138/3 "2012-01-26T14:27:06Z")

</div>

se sono applicazioni rails/rack, puoi “montarle”. sinceramente non ho  
mai  
provato “rails su rails”, anche perch probabilmente avrei il dubbio che  
ci  
possano essere altre soluzioni pi eleganti per lo stesso problema 😛

un paio di letture qui:

[http://inductor.induktiv.at/blog/2010/05/23/mount-rack-apps-in-rails-3/](http://inductor.induktiv.at/blog/2010/05/23/mount-rack-apps-in-rails-3/)

> **[Rails on Rack — Ruby on Rails Guides](https://guides.rubyonrails.org/rails_on_rack.html)**
>
> Rails on RackThis guide covers Rails integration with Rack and interfacing with other Rack components.After reading this guide, you will know: How to use Rack Middlewares in your Rails applications. Action Pack's internal Middleware stack. How to...

se un problema di path, puoi gestire tutto dal file confgi/routes.rb

> **[Rails Routing from the Outside In — Ruby on Rails Guides](https://guides.rubyonrails.org/routing.html)**
>
> Rails Routing from the Outside InThis guide covers the user-facing features of Rails routing.After reading this guide, you will know: How to interpret the code in config/routes.rb. How to construct your own routes, using either the preferred...

ciao,  
A.

Il 26/01/2012 14:07, Iwan B. ha scritto:

---

<div class="post-metadata">

**Author:** ![1w4n](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/1/65b543/32.png) [@1w4n](https://www.ruby-forum.com/u/1w4n)\
**Post date:** [February 6, 2012, 5:36pm UTC](https://www.ruby-forum.com/t/livello-ulteriore-nel-path/216138/4 "2012-02-06T17:36:37Z")

</div>

Namespace non andava bene in quanto avrei dovuto modificare nelle viste  
tutti gli helper dei path (es.: posts\_path in service\_1\_posts\_path). Non  
mi sembrava il caso.

Bisogna usare scope:

scope “/service\_1” do  
…  
end

(v. anche  
[ruby on rails - What is the replacement for ActionController::Base.relative\_url\_root? - Stack Overflow](http://stackoverflow.com/questions/3181746/what-is-the-replacement-for-actioncontrollerbase-relative-url-root))

Grazie per i preziosi suggerimenti!

ciao!
