Vahagn Hayrapetyan wrote:
> Hi,-
>
> I have a main page with a search box. When the user enters a query and
> hits "Search" I want to redirect him to another page (another
> controller with a search action), and display the results on that
> page. My form looks like this:
>
> <% form_tag({:controller => "projects", :action =>
> "search"}, :method => "get") do %>
> <label for ="q">Enter search phrase: </label>
> <%= text_field_tag "q", params[:q] %>
> <input type ="submit" value="Go" />
> <% end %>
>
> The error I get is:
>
> ActiveRecord::RecordNotFound in ProjectsController#show
>
> Couldn't find Project with ID=search
>
> How do I override the default route for this, so it doesn't think
> search is an id?
>
> http://localhost:3000/projects/search?q=foo ?
>
> Thanks.
you are useing get method
so the action name will passed as params[:id]
just remove get method
then try
--
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---