JoaoRodrigues Posted May 8, 2008 Report Share Posted May 8, 2008 Pessoal, estou a tentar seguir um livro que me de Ruby, já meio desactualizado (2006). Os exemplos têm funcionado e eu até tenho inventado com sucesso algumas coisas. Agora, estou empancado aqui neste exemplo porque me dá um erro estranho, que eu não sei resolver. Tem que ver com a form action da pagina 124 do Wrox Beggining Ruby on Rails. Alguém opina? <html> <head> <title>Using Text Fields</title> </head> <body> <h1>Working With Text Fields</h1> This Ruby on Rails application lets you read data from text fields. <br> <form action = “/look/at” > Please enter your name. <br> <input type=”text” name=”text1”> <br> <br> Below is the Button <br> <input type=submit> </form> </body> </html> O controller que tenho é: class LookController < ApplicationController def at @data = params[:text1] end end E a view do at é: <html> <head> <title>Reading data from text fields</title> </head> <body> <h1>Reading data from text fields</h1> This Ruby on Rails application reads data from text fields. <br> <br> Your name is <%= @data %>. <br> <br> </body> </html> Desculpem estar misturar HTML com o código de ruby... Link to comment Share on other sites More sharing options...
JoaoRodrigues Posted May 8, 2008 Author Report Share Posted May 8, 2008 Problema resolvido. Pelos vistos quem correr isto no XP e/ou no IE, não tem problema. Firefox e/ou Linux atrofia 😄 O problema é a barra na form action. A escrita "correcta" será: <form action = "look/at" > E já agora, copy paste de livros nunca é bom 😛 Colei umas aspas mega estranhas e pelos vistos... ups... 😄 Fica aqui o link que me ajudou: http://p2p.wrox.com/topic.asp?TOPIC_ID=55262 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now