0

The following code in not rendering even the buttons:

<% form_tag :controller=> :create_new, :action=>:input do %>
<%=text_field_tag :my_input%>
<%=submit_tag "Send input"%>
<%end%>

the controller create_new has the following method:

def input
@my_input=params[:my_input]
end

the routes.rb has::

resources :create_new do
   post :input, :on=>:collection
4

3 回答 3

1

Use <%= form_tag instead of <% form_tag.

于 2013-01-29T10:34:47.390 回答
0
<%= form_tag input_create_new_path, :html_options => {:method => :post} do |f| %>
  <%= f.text_field :my_input%>
  <%= f.submit "Send input"%>
<%end%>
于 2013-01-29T10:48:56.840 回答
0

对于 rails 3,我们必须对 form_tag 和 form_for 使用“=”符号。所以改变你的代码如下..

 <%=form_tag :controller=> :create_new, :action=>:input do %>
 <%=text_field_tag :my_input%>
 <%=submit_tag "Send input"%>
 <%end%>
于 2013-01-29T10:42:09.897 回答