Salai Koko wrote:
> Dear All,
> 
> Can you guide me how can i implement a search function in my simple
> Bookmark program. In my Bookmark I have "title" and "url",
> "description". What I want to do is "search_by" "title".
> 
> many thanks in advance,
> 
> regards,
> koko

view:

<%form_for :search, :url => {:action => 'search', :controller=>'aaa'} do 
|f| %>
    Search:
    <%= f.text_field :query %>
    <%= submit_tag "Search" %>
<% end %>

Controller:

def search
  t = params[:search][:query]
  @q = Model.find(:all, :conditions=>["title like ? AND url like ? AND 
description like ?", t,t,t"])
end
-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to