Ruby on Rails
Thursday, September 18, 2014
Done!
Then I put
<%= link_to "some text", /factory/demo/message/1389/ %>
in my .erb file
but getting the following error:
Completed 500 Internal Server Error in 56ms
SyntaxError (/home/pdipietro/gsn/app/views/identity_providers/index.html.erb:35: syntax error, unexpected ',', expecting ')'
....append=( link_to ("some text", /factory/demo/message/1389) ...
... ^
/home/pdipietro/gsn/app/views/identity_providers/index.html.erb:35: syntax error, unexpected ')', expecting keyword_end
..., /factory/demo/message/1389) );@output_buffer.safe_append='
... ^):
app/views/identity_providers/index.html.erb:35: syntax error, unexpected ',', expecting ')'
app/views/identity_providers/index.html.erb:35: syntax error, unexpected ')', expecting keyword_end
I tried a lot of variants with no success!
Any idea?
Il giorno giovedì 18 settembre 2014 22:28:53 UTC+2, Jarmo Isotalo ha scritto:
-- Then I put
<%= link_to "some text", /factory/demo/message/1389/ %>
in my .erb file
but getting the following error:
Completed 500 Internal Server Error in 56ms
SyntaxError (/home/pdipietro/gsn/app/views/identity_providers/index.html.erb:35: syntax error, unexpected ',', expecting ')'
....append=( link_to ("some text", /factory/demo/message/1389) ...
... ^
/home/pdipietro/gsn/app/views/identity_providers/index.html.erb:35: syntax error, unexpected ')', expecting keyword_end
..., /factory/demo/message/1389) );@output_buffer.safe_append='
... ^):
app/views/identity_providers/index.html.erb:35: syntax error, unexpected ',', expecting ')'
app/views/identity_providers/index.html.erb:35: syntax error, unexpected ')', expecting keyword_end
I tried a lot of variants with no success!
Any idea?
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 routeget ':part1/(:part2/(:part3))' =>'demo#demo'And controllerclass DemoController < ApplicationController
def demo
render plain: params.inspect
end
endAnd 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:
:controllermaps to the name of a controller in your application, and:actionmaps 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/1is processed by this route (because it hasn't matched any previous route in the file), then the result will be to invoke theshowaction of thePhotosController, and to make the final parameter"1"available asparams[:id]. This route will also route the incoming request of/photostoPhotosController, since#index :actionand:idare 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+unsubscribe@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/3c33650a-8679-46d2-8a24-db17997b9cca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment