I have a RAILS model named ‘sac_database’ with a column ‘databae_name’.
It works fine when I try to show the records found from my database, for
example, this works fine in my view (list.rhtml):
<% @sac_database.each do |c| %>
<%= c.database_name -%>
<% end %>
But, I need to add a text_field for the column ‘databae_name’ (in order
to search), and I tried something like this in my view:
<%= start_form_tag :action => ‘search’ %>
<%= text_field “sac_database”, “database_name”, “size” => 20 %>
<%= submit_tag ‘Search’ %>
<%= end_form_tag %>
It gives me this error:
undefined method `database_name’ for #Array:0x4b95920
I have tried many possibilities, like
<%= text_field params[:sac_database], params[:database_name],
“size” => 20 %>
but none was successful.
Could anybody point to where the problem is with this simple text_field
Any help would be greatly appreciated.