now in my controller how do i access the field in the text box?
from my reading, the first parameter is the object, second is the
method, third are the options. how do i make it so i dont need a method,
i just want the string in the text box?
ok so <%= text_field(‘search1’, ‘’, :size => 25)%>
ok, so search1 is the name of the symbol that i use in params[:search1],
and the second parameter is just what i want for a default value for
search1 right?
text_field(“post”, “title”, “size” => 20), which will build for you
the following html.
Which when received by your controller will give you a params hash as:
params[:post][:title]
sending the above prams to a Post model,
p = Post.new(params[:post]) will initialize the title method of p(a
Post instantiation) with the value typed in the html form.