check out http://railscasts.com/episodes/100

It explains the use of - in Erb.

-Matt

On 4/9/08, Glenn Little <[EMAIL PROTECTED]> wrote:
>
>
> On the submit tag you need an "=":
>
>    <%= submit_tag 'Search' %>
>
> Regarding the "-", my understanding is that it just suppresses
> a newline in the output.
>
>
>         -glenn
>
>
> Scott Olmsted wrote:
> >
> > 1st question:
> >
> > I'm using Rails 2.0.2 and incorporating  will_paginate   into my first
> > app. I borrowed the code at
> > http://github.com/mislav/will_paginate/wikis/simple-search to display a
> > search form:
> >
> > <% form_tag request.path, :method => 'get' do -%>
> >   <% content_tag :label do %>
> >     Search term:
> >     <%= text_field_tag :search, params[:search] %>
> >   <% end %>
> > <% end %>
> >
> > but it has no 'Search' button, so I added a  submit_tag to produce it:
> >
> > <% form_tag request.path, :method => 'get' do -%>
> >   <% content_tag :label do %>
> >     Search term:
> >     <%= text_field_tag :search, params[:search] %>
> >   <% end %>
> >   *<% submit_tag 'Search' %>
> > *<% end %>
> >
> > but didn't get one:
> >
> > <form action="/stories"
> > method="get">  <label>
> >     Search term:
> >     <input id="search"
> > name="search" type="text" />
> >   </label>
> >
> > </form>
> >
> > I suspect the blank line is where it hiccuped and didn't spit it out.
> > What am I doing wrong?
> >
> >
> > 2nd question:
> >
> > What does the  '-%>'  tag in the first line do that '%>' doesn't?
> >
> > Thanks,
> > Scott
> >
> > >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to