jump to navigation

Ruby on Rails & PHP

In Ruby On Rails You Will Find the Following Posts: -

[A] Ajax On Rails Auto Select

[B] Create Scaffolding with Rails 1.2.5

In PHP Section You Will Find the Following Posts: -

[A] Validates Username and Password with PHP

[B] Create a Secure PHP Login Script

Articles that are in Moderation:
[1] Creating a Examination Section, Where Students can Give Online Exams and can able to See their Performances Using RoR.

[2] File Uploading. Sharing and Downloading With Multiple Users Using RoR

[3] How to create Communities, Publishing Posts in that Comm. Using Rails.

and Many More…. So Stay with Me.. I will keep You Updating

Waiting for Your Valuable Responses

Your Friend

Puneet Pandey

Comments»

1. Sondra - March 3, 2009

How can I make a multiple field search in Rails?, Whitout ajax

2. Puneet Pandey - March 4, 2009

Hi,

If I am not wrong you have a single table with multiple columns and you want to search your keyword within those columns, If this is the scenario, you should write:

query = params[:q]
@contacts = Contact.find(:first, :conditions => ["first_name LIKE query or last_name LIKE query or email LIKE query"])

Where 1.params[:q] is the name of your search text field
2. first_name, last_name, email are the columns name of your table
3. Contact is your model and contacts will be your table name

Hope this helps

Regards
Puneet