Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails form_tag not showing

I am following this simple tutorial http://railscasts.com/episodes/37-simple-search-form which seems to be great but, my form tag doesnt seem to work. Here is my html code! The form tag doesnt even show up.

<h1>Listing applications</h1>

<% form_tag applications_path do %>
    <p>
        <%= text_field_tag :search %>
        <%= submit_tag "Search" %>
    </p>
<% end %>

<table>
  <tr>
    <th>Name</th>
    <th>Enviroment</th>
    <th>Applicationurl</th>
    <th>Server</th>
    <th>Additional Servers</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @applications.each do |application| %>
  <tr>
    <td><%= application.name %></td>
    <td><%= application.date %></td>
    <td><%= application.size %></td>
    <td><%= application.author %></td>
    <td><%= application.addi_servers %></td>
    <td><%= link_to 'Show', application %></td>
    <td><%= link_to 'Edit', edit_application_path(application) %></td>
    <td><%= link_to 'Destroy', application, confirm: 'Are you sure?', method: :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New Application', new_application_path %>

And I have only one model, "Application"

like image 712
Test Test Avatar asked Aug 24 '12 09:08

Test Test


Video Answer


1 Answers

According to the guide you need a = before form_tag

<%= form_tag("/search", :method => "get") do %>
  <%= label_tag(:q, "Search for:") %>
  <%= text_field_tag(:q) %>
  <%= submit_tag("Search") %>
<% end %>
like image 150
Dty Avatar answered Sep 18 '22 22:09

Dty