I’m learning how to create and handle a form in Rails + HAML.
My view looks like so:
= form_tag sessions_path do
= text_field_tag :username, ""
= password_field_tag :password, ""
= submit_tag "log in"
It gives this html:
...
<form accept-charset="UTF-8" action="/sessions" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="WWg2IuLNo+7VZFIpOAFaUJseF7YCn2xiVcieI6zJGx4=" /></div>
<input id="username" name="username" type="text" value="" />
<input id="password" name="password" type="password" value="" />
<input name="commit" type="submit" value="log in" />
</form>
...
My create method looks like this:
def create
render "myview"
end
Basically I don’t know how to access in method the data that was filled in to the form fields.
Your question is not informative. Can you provide some more info. about what you want to do?
Anyway you can do this:
In controller: