The direction seems to be right, so I created

1) the route

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

2) the factory controller

Then I add the following line to my .erb

<%= link_to "some text", factory/demo/user/9 ) %>

but it returns the following error:

Completed 500 Internal Server Error in 45ms

SyntaxError 
(/home/pdipietro/gsn/app/views/identity_providers/index.html.erb:33: syntax 
error, unexpected ')', expecting keyword_end
... text", factory/demo/user/9 ) );@output_buffer.safe_append='
...                               ^):
  app/views/identity_providers/index.html.erb:33: syntax error, unexpected 
')', expecting keyword_end

Any further suggestion?

Paolo



Il giorno giovedì 18 settembre 2014 22:28:53 UTC+2, Jarmo Isotalo ha 
scritto:
>
> 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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/9d2c785c-64ec-433b-9bc9-f3906372cc8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to