I don't know how much this helps, but I've learned the hard way that,
when I write

<%= blah :blah, :blah do |x| %>
<% end %>

I get bizarre (and always incorrect) results.


The reason is that <%= ... %> results in a string that gets inserted
into your HTML stream, while <% ... %> results in some Ruby code that
gets executed with no output going to the HTML stream.  If the Ruby
code includes a block, then, presumably, that block will output the
HTML stuff you were hoping to output.

--wpd



On Wed, Aug 26, 2009 at 9:58 AM, Aldric
Giacomoni<rails-mailing-l...@andreas-s.net> wrote:
>
> Okay, so this is what I have (which fails miserably) in my view:
>
> Please enter a username:
> <%= form_remote_tag :html => { :update => "filter_counts",
>  :url => {:action => "search_by_name"} }do -%>
> <div><%= text_field_tag 'username', :maxlength => 15, :size => 12
> %></div>
> <div><%= submit_tag 'Search' %></div>
>  <% end -%>
>
>
> "filter_counts" is a div, "search_by_name" is the action, I think the
> rest makes sense.
>
> And here is my error:
>
> compile error
> C:/scripts/Rads/app/views/dictated_exams/index.html.erb:5: syntax error,
> unexpected ')'
>  :url => {:action => "search_by_name"} }do ).to_s)
>                                             ^
> C:/scripts/Rads/app/views/dictated_exams/index.html.erb:36: syntax
> error, unexpected kENSURE, expecting ')'
> C:/scripts/Rads/app/views/dictated_exams/index.html.erb:38: syntax
> error, unexpected kEND, expecting ')'
>
> Extracted source (around line #5):
>
> 2: <center>
> 3: Please enter part of a name ('%' is the wild card character):
> 4: <%= form_remote_tag :html => { :update => "filter_counts",
> 5:   :url => {:action => "search_by_name"} }do -%>
> 6: <div><%= text_field_tag 'username', :maxlength => 15, :size => 12
> %></div>
> 7: <div><%= submit_tag 'Search' %></div>
> 8:   <% end -%>
>
>
> ________
> Help is much appreciated!
> --
> 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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to