Beginner question getting data from textbox

I am just doing a simple book exercise

and i keep getting this error in the browser:

no route found to match “/\look\at” with {:method=>:get}

i have an action named at set up in my controller

class LookController < ApplicationController
def at
@data = params[:text1]
end

end

i have the main public page where i get the user input:

Using Text Fields

Working with textfields

This Ruby on Rails application lets you read data from text fields
Please enter your name.



and i have a view to spit out the data the user enters:

Returning data from text fields in a view

Working with textfields

This view returns the data from the text field in input.html

Your name is <%= @data %>

all the files are in the correct directories, the input.html one is in
public the controller is in its default location and the at.rhtml file
is in views.

What am i missing can anyone see it?

thanks

Corey K. wrote:

@data = params[:text1]

http-equiv=“content-type”>





[…snip…]

all the files are in the correct directories, the input.html one is in
public the controller is in its default location and the at.rhtml file
is in views.

What am i missing can anyone see it?

Use forward slashes “/” in your path not backslashes “” even if you are
on Windows.


Michael W.

tried that it didnt work either, still get the same routing error

Hi Corey, I forget step ©, (d), and (e)

c) add the file at.rhtml to /app/views/look folder if it’s not already
there
d) start the webserver in windows by going to the root of your rails
application

 ruby script/server webrick

e) go to your browser and type the following in the address field

 http://localhost:3000/look/input

Good luck,

-Conrad

Hi, you should change

to

Also, I would recommend do the following:

a) change your input file to input.rhtml
b) copy the file to app/views/look folder

The above should do what you want.

Good luck,

-Conrad

Conrad T. wrote:

Hi Corey, I forget step ©, (d), and (e)

c) add the file at.rhtml to /app/views/look folder if it’s not already
there
d) start the webserver in windows by going to the root of your rails
application

 ruby script/server webrick

e) go to your browser and type the following in the address field

 http://localhost:3000/look/input

Good luck,

-Conrad

you make a point that caught my eye when you say to make the input.html
into a view. The author says to put it in the public folder as just an
html file, isnt the author departing from the MVC design by doing that?
I dont know what the public folder is for at this point havnt gotten
that far in the book. Should i generally make all web content into views
or is there times when you want just basic html files in the public
folder?

Conrad T. wrote:

Hi Corey, I forget step ©, (d), and (e)

c) add the file at.rhtml to /app/views/look folder if it’s not already
there
d) start the webserver in windows by going to the root of your rails
application

 ruby script/server webrick

e) go to your browser and type the following in the address field

 http://localhost:3000/look/input

Good luck,

-Conrad

OK thanks, i tried it in IE and it works fine but for some reason it
doesnt work in firefox unless i clear the entire browser cache between
exercises. There is some information that is getting stored in the
browser that causes that routing error i tried it several times and
everytime it didnt work unless i cleared out all my private data in
firefox. Its kind of one of those strange computer problems where its
hard to see why something is happening.