Re: Newbie: Searcing database via user form input?

Dale Cunnigham
2008-05-29T15:13:18Z

Robert Walker wrote:
> First, it looks to me like you''re attempting to do exactly what
Ryan
> Bates shows in episode #37 of Railscasts:
>
> http://railscasts.com/episodes/37
>
> Second: What''s this?
>> <% form_tag({ :action => "index", :controller =>
"users" }, :method =>
>> "index") do %>
> There is no "index" method in HTTP. This should be one of :get
> or :post in the context of an HTML form.
>
> On May 28, 8:24�am, Dale Cunnigham <rails-mailing-l...@andreas-s.net>

Ok so I followed the instructions in that rails cast (thanks for that,
really great resource) but I''m now getting a routing/path problem...

 ActionController::RoutingError in Users#index

Showing users/index.html.erb where line #9 raised:

user_url failed to generate from {:action=>"show",
:controller=>"users"}
- you may have ambiguous routes, or you may need to supply additional
parameters for this route.  content_url has the following required
parameters: ["users", :id] - are they all satisfied?

Extracted source (around line #9):

6:
7:
8:
9: <% form_tag user_path, method => ''get'' do %>
10:
11:     <%= text_field_tag :search, params[:search] %>
12:     <%= submit_tag "Search Users", :name => nil %>

so it looks like it cant render user_path to an appropriate url.

My routes.rb file does contain

ActionController::Routing::Routes.draw do |map|
  map.resources :users

So I thought user_path would be generated by that line automatically,
and then the page gets routed to the ''index'' action
automatically no?
--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com