Thufir
(Thufir)
January 23, 2008, 11:10am
1
I want to drop deprecated code as per:
start_form_tag and end_form_tag
Use form_tag with a block.
However, I'm not sure how to do a block from the rhtml file. Somewhere I
need curly braces for a block? Or, does it mean an "end" statement? The
embedded part is throwing me off a bit.
thufir@arrakis ~/strawr $
thufir@arrakis ~/strawr $ cat app/views/feeds/show.rhtml -n | head -n 53
tail -n 18
36
37 <% @unused_tags =
38 Tag.find(:all) - @feed.tags %>
39
40 <% if @unused_tags.any ? %>
41
42 <%= form_tag :action => "add_some_tags",
43 :id => @feed %>
44 <b>Add a tag:</b><br>
45 <% @unused_tags.each {|tag| %>
46 <%= check_box('tag'+tag.id.to_s, 'checked') +
47 tag.tag %><br/>
48 <% } %>
49 <%= submit_tag %>
50 <%= end_form_tag %>
51 <% end %><p>
52
53
thufir@arrakis ~/strawr $
http://code.google.com/p/strawr/source
thanks,
Thufir
I want to drop deprecated code as per:
start_form_tag and end_form_tag
Use form_tag with a block.
Ruby on Rails — A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.
However, I'm not sure how to do a block from the rhtml file.
Somewhere I
need curly braces for a block? Or, does it mean an "end"
statement? The
embedded part is throwing me off a bit.
<% form_tag :action => 'foo' do %>
bla bla bla
<% end %>
Thufir
(Thufir)
January 24, 2008, 9:01am
3
Following this (and trying to follow the API) results in:
SyntaxError in Feeds#show
Showing app/views/feeds/show.rhtml where line #43 raised:
compile error
/home/thufir/strawr/app/views/feeds/show.rhtml:43: syntax error,
unexpected ')'
_erbout.concat " "; _erbout.concat(( form_tag :action =>
"add_some_tags", :id => @feed.id do ).to_s); _erbout.concat "\n"
^
/home/thufir/strawr/app/views/feeds/show.rhtml:50: syntax error,
unexpected kEND, expecting ')'
end ; _erbout.concat "<p>\n"
^
/home/thufir/strawr/app/views/feeds/show.rhtml:57: syntax error,
unexpected kEND, expecting ')'
Extracted source (around line #43 ):
40: Tag.find(:all) - @feed.tags %>
41:
42: <% if @unused_tags.any ? %>
43: <%= form_tag :action => "add_some_tags", :id => @feed.id do %>
44: <b>Add a tag:</b><br>
45: <% @unused_tags.each {|tag| %>
46: <%= check_box('tag'+tag.id.to_s, 'checked') + tag.tag %><br/>
If line 44 is syntactically correct (which I think it is, then perhaps
the source of the error message lies in line 46, converting
tag.id.to_s ,or maybe there's a missing "end" (but that part looked ok to
me).
for source code:
http://code.google.com/p/strawr/source
and
http://strawr.googlecode.com/svn/trunk/app/views/feeds/show.rhtml
thanks,
Thufir
<% form_tag :action => 'foo' do %>
bla bla bla
<% end %>
Following this (and trying to follow the API) results in:
Well you haven't done that. you've used <%=, whereas I used <%
Fred