trouble understanding rhtml forms

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

<% form_tag do -%> <p><label for="email">Email: </label><br/> <%= text_field_tag 'email' %></p>

<p><label for="password">Password</label><br/> <%= password_field_tag 'password' %></p>

<p><label for="remember_me">Remember me:</label> <%= check_box_tag 'remember_me' %></p>

<p><%= submit_tag 'Log in' %></p> <% 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

Hi,

gmoniey@gmail.com 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

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.