SyntaxError in Community#index ใน RailsSpace
ตามโค้ดใน Listing 11.1.1 ของ RailsSpace (หน้า 328) เขียนโค้ดแบบนี้
<% form_tag({ :action => "search" }, :method => "get") do %>
...
<% end %>
แต่ว่าถ้าเราเขียนตามตัวอย่างใน Rails 2.2 เราจะเจอ error ว่า
SyntaxError in Community#index
Showing app/views/community/_search_form.html.erb where line #1 raised:
compile error
/Users/Tik/temp/rails_space/app/views/community/_search_form.html.erb:1: syntax error, unexpected tASSOC, expecting '}'
...e=true ; form_tag {:action => "search"}, :method => "get" d...
^
/Users/Tik/temp/rails_space/app/views/community/_search_form.html.erb:1: syntax error, unexpected ',', expecting kEND
...orm_tag {:action => "search"}, :method => "get" do ; @output...
วิธีแก้ก็ง่ายๆ แค่เอา :action ออกจาก hash ก็เรียบร้อย เพราะดูเหมือนว่า Rails 2.2 ไม่ต้องการ hash สำหรับ :action แล้ว