--
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-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1bd51146-c7db-49ab-8666-30b9679caf5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
get ':part1/(:part2/(:part3))' =>'demo#demo'class DemoController < ApplicationController
def demo
render plain: params.inspect
end
endWhen 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:
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.
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
--
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-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@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.
<%= link_to "some text", "factory/demo/user/9" %><%= link_to "some text", "/factory/demo/message/1389/" %><%= link_to("some text", "/factory/demo/message/1389/") %>Done!
Then I put
<%= link_to "some text", /factory/demo/message/1389/ %>
in my .erb file
<%= link_to "test", "/foo/bar/" %>