Forum: Ruby on Rails Strange error: Could anybody please help?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Niaz A. (Guest)
on 2007-07-18 21:39
Hi,
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
tag?
Any help would be greatly appreciated.
Thanks,
Arif
This topic is locked and can not be replied to.