Re: HTML shortcuts

Marnen Laibow-Koser
Mon, 28 Dec 2009 15:31:04 -0000

Corey Konrad wrote:
> Zack Chandler wrote:
>> Corey,
>>
>> That is the older deprecated way.  The new way is:
>>
>> <% form_tag :action => ''create'' do %>
>>   ...
>> <% end %>
>>
>> Hope this helps.
>>
>> --
>> Zack Chandler
>> http://depixelate.com
>
> Ok thanks, i still dont see how that new way is a shortcut though, why
> not just use the normal HTML way? does the form_tag above do something
> different than the normal HTML tag?

Yes.  It calculates the URL for the form from the controller and action,
which is a big help since Rails doesn''t use direct URLs much.  In
addition, if you use form_for, it also creates a FormBuilder object so
you can use Rails'' helpers for form elements, which automatically pick
up values from the object. .

> It just seems like a way of
> using ruby to create a form instead of HTML

It is.

> what is the practical
> difference?

The URL calculation is a big difference.

>
> thanks

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org
--
Posted via http://www.ruby-forum.com/.

--

You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org