# Trouble understanding rhtml forms

**URL:** <https://www.ruby-forum.com/t/trouble-understanding-rhtml-forms/92318>\
**Category:** Rails\
**Created:** [April 18, 2007, 7:55am UTC](https://www.ruby-forum.com/t/trouble-understanding-rhtml-forms/92318 "2007-04-18T07:55:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 18, 2007, 7:55am UTC](https://www.ruby-forum.com/t/trouble-understanding-rhtml-forms/92318/1 "2007-04-18T07:55:04Z")

</div>

i dont understand where the following points to the actual post  
method:

\<% form\_tag do -%\>

Email:   
\<%= text\_field\_tag 'email' %\>

Password  
\<%= password\_field\_tag 'password' %\>

Remember me: \<%= check\_box\_tag 'remember\_me' %\>

\<%= submit\_tag 'Log in' %\>

\<% end -%\>

it seems to automatically direct to my login def in my controller, but  
i dont understand how.

Could someone please clear this up

thanks

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 18, 2007, 3:32pm UTC](https://www.ruby-forum.com/t/trouble-understanding-rhtml-forms/92318/2 "2007-04-18T15:32:40Z")

</div>

Hi,

removed\_email\_address@domain.invalid wrote:

> i dont understand where the following points to the actual post  
> method:
> 
> \<% form\_tag do -%\>

I’m pretty sure it doesn’t. You’re missing the path in the form\_tag  
which  
should look something like:  
\<% form\_tag ‘controller/method’ do -%\>

> it seems to automatically direct to my login def in my controller,  
> but i dont understand how.

I’m guessing you’ve probably got some code that takes non-logged-in  
visitors  
to that method / page to avoid unauthorized access. That would probably  
account for the behavior, although it seems to me that it would be  
better if  
this threw a syntax error instead.

hth,  
Bill

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 18, 2007, 7:03pm UTC](https://www.ruby-forum.com/t/trouble-understanding-rhtml-forms/92318/3 "2007-04-18T19:03:38Z")

</div>

Hi Bill,

Thanks for the reply. I actually got this code from the  
act\_as\_authenticated plugin, and it doesn’t what i posted is exactly  
what is in the rhtml file, thats why i am struggling to figure out how  
it works. I seems like it is missing the controller/method tag as you  
mentioned, but it still figures things out.

I guess I have just been struggling to figure out rails. I have went  
through some tutorials, but most of them are like: “look…it works!”,  
where as I want to know why it works, how things are binded together,  
etc.
