Regarding routes

I have a controller with only one action “res” . I need to redirect to
this controller file for decrypting the code ,so can the url to this be

  1. “http://…:3000/user_controller.rb?DR={DR}”

                  (OR)
    
  2. “http://…:3000/user/res?DR={DR}”

is their any possibility of having url as in (1)

On Oct 15, 2012, at 4:44 AM, nike ed wrote:

is their any possibility of having url as in (1)
I don’t believe it is at all possible to have 1, but 2 is certainly
do-able. Have a read through the Rails Guide: Routing from the Outside
In. It covers the details of creating routes for nearly any URL you
might want to handle.

I suppose you could make the URL read user_controller.rb if you wanted
to, it’s just a text string after all, but remember back to when you set
up Apache or another Web server for your Rails hosting. The “site root”
(publicly exposed directory, from Apache’s point of view) is the
/yourapp/public folder. All of your controllers are at
/yourapp/app/controllers – completely outside of the public folder,
therefore not directly addressable by an external URL.

So while you could make a route respond to your #1 URL, in no way would
the actual request be going directly to that controller file in the
app/controllers folder – it would be treated as any other synthetic URL
in the Rails system, parsed for its meaning and directed by a “front
controller” to the appropriate controller according to the rules of
routing.

Walter

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs