Routing Error

Hello,

I’m just starting to learn Ruby on Rails. I’m following a tutorial in
a book but the examples are not working, I keep getting Routing Error
“no route found to match “/\look\at” with {:method=>:get}”

What I have is a pretty simple example. I’ve put all the files in the
correct directories


In ‘…\app\controllers\look_controller’ I have:
class LookController < ApplicationController
def at
@data = params[:text1]
end
end

In ‘…\app\views\look\at.rhtml’ I have:

Your name is <%= @data %> ------------------------------------------------------------------- In '..\public I have:
Please enter your name.

---------------------------------------------------------------------

When I start the server and navigate to http://localhost:3000/input.html
I get the input.html page. When I use the submit button I get the
Routing Error. I have no idea why. At this point learning Ruby on
Rails isn’t much fun :frowning:

Please help.

Thank you.

Brad

Um… You’re not supposed to put your form as a page in the public
directory.
That’s reserved for things more like pictures/javascript/stylesheets.

You should make another view for your form which can then post to the
other
action.

On Dec 7, 2007 9:29 AM, Brad [email protected] wrote:


     <title></title>
</head>


Ryan B.

On 6 Dec 2007, at 22:59, Brad wrote:

<body>
<form action = "\look\at">
<br>

You shouldn’t be using backslashes, even if you’re on a machine which
uses backslash as its path delimiter. When you’re dealing with URLs, /
is the one true path delimiter.

Fred

Thank you for your help. It was the backslashes, now I feel silly for
not trying that before I posted :slight_smile:

Thanks again.

Brad

On Dec 6, 7:07 pm, Frederick C. [email protected]

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