Searching a record

I have a table called project. I want to make a search window to search
particuler project details when I enter the project name. I have done
followings.

create a project controller and insert

def search
@project = Project.find_by_name(params[“x”])
end

then create a view for the searching window as follows( inside project
directory)

<% form_tag(:controller => “projcet” , :action => “search”) do %>

<%= text_field_tag “x” %>
<%= submit_tag %>
<% end %>

then I create a seacrh.html.rb inside the project directory and insert

<% if @project.empty? %>
No project found
<% else %>
<% @project.each do |project| %>
<%= link_to project.name, project_url(project)%>


<% end %>
<% end %>

then I click the seach button i’m gettin following error

Routing Error

No route matches “/projcet/search” with {:method=>:post}

I WOULD MUCH APPRECIATE if any one can help me to solve this…

On Thu, Mar 25, 2010 at 9:44 PM, Nipuna W.
[email protected] wrote:

I have a table called project.

Shouldn’t the table name be plural, “projects” ?

<% form_tag(:controller => “projcet” , :action => “search”) do %>

projcet != project ?

No route matches “/projcet/search” with {:method=>:post}


Greg D.
destiney.com | gregdonald.com

Hi…

On Fri, 2010-03-26 at 03:44 +0100, Nipuna W. wrote:

then create a view for the searching window as follows( inside project
directory)

<% form_tag(:controller => “projcet” , :action => “search”) do %>
---- ^^^^^^^
try fixing this typo ^^^^^^^


<% @project.each do |project| %>

I WOULD MUCH APPRECIATE if any one can help me to solve this…


Craig


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Craig W. wrote:

Hi…

On Fri, 2010-03-26 at 03:44 +0100, Nipuna W. wrote:

then create a view for the searching window as follows( inside project
directory)

<% form_tag(:controller => “projcet” , :action => “search”) do %>
---- ^^^^^^^
try fixing this typo ^^^^^^^


<% @project.each do |project| %>

I WOULD MUCH APPRECIATE if any one can help me to solve this…


Craig


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

HI CRAIG and DONALD,

I CHANGED THE CTROLLERNAME TO project but still i’m getting the same
error.
PLEASE HELP ME.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs