Im not sure if I get what exactly you are trying to accomplish, but:

with route

get ':part1/(:part2/(:part3))' =>'demo#demo'

And controller
class DemoController < ApplicationController
  def demo
    render plain: params.inspect
  end
end
 
And thus /foo, /foo/bar and /foo/bar/baz will use DemoController#demo and 
:part1 :part2 and :part3 can be accessed from params hash





# And just a snippet 
from http://guides.rubyonrails.org/routing.html#bound-parameters
3.1 Bound Parameters

When you set up a regular route, you supply a series of symbols that Rails 
maps to parts of an incoming HTTP request. Two of these symbols are 
special: :controller maps to the name of a controller in your application, 
and :action maps to the name of an action within that controller. For 
example, consider this route:
get ':controller(/:action(/:id))'

If an incoming request of /photos/show/1 is processed by this route 
(because it hasn't matched any previous route in the file), then the result 
will be to invoke the show action of the PhotosController, and to make the 
final parameter "1" available as params[:id]. This route will also route 
the incoming request of /photos to PhotosController#index, since :actionand 
:id are optional parameters, denoted by parentheses.


On Thursday, September 18, 2014 10:02:27 PM UTC+2, Paolo Di Pietro wrote:
>
> No, I still cannot do it. 
>
> I cannot use Hobo because I'm using Neo4j NoSql db, which doesn't run with 
> Hobo.
>
> I just would like to set up an abstract route redirecting everything to my 
> AbstractController! 
>
> Il giorno martedì 16 settembre 2014 10:37:11 UTC+2, Jarmo Isotalo ha 
> scritto:
>>
>> Cant you do it already?
>>
>> On Monday, September 15, 2014 6:34:46 PM UTC+2, Paolo Di Pietro wrote:
>>>
>>> Hi all,
>>>
>>> I'd like to implement (Rails 4)  a very high level (generic) abstract 
>>> controller, able to manage any route and then create a viewer on the fly.
>>>
>>> I'd like to call it 'abstracts', and being able to call as
>>>
>>> :abstract(/:subject(/:action(/:id)))
>>>
>>> something like 
>>>
>>> abstract/user/create 
>>> or 
>>> abstract/identity/:john/edit
>>>
>>> I'm not sure on the best way to define the correct route, and how to 
>>> generate the model and the view code on the fly, after getting the 
>>> definition in the controller from the DB.
>>>
>>> Any suggestion is appreciated.
>>>
>>> Paolo
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/4d4b31a5-58fb-46d7-93c8-b6fc0e875ea9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to