Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6652443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:08:21+00:00 2026-05-26T01:08:21+00:00

For some reason my search form is not working correctly when my app is

  • 0

For some reason my search form is not working correctly when my app is launched, in the localhost its working without a problem but when I go to use the search on the launched app the search seems to be broken. I can’t figure out why, I followed the Railscasts Simple Search Form to implement it and it hasn’t been a problem in local at all.

My user model looks like

   def self.search(search)
     if search
       find(:all, :conditions => ['name LIKE ?', "%#{search}%"])
     else
       find(:all)
     end
   end

My users controller index looks like

   def index
     @users = User.search(params[:search])
     @title = "All Users"

     respond_to do |format|
       format.html
       format.json { render :json => @users }
     end
   end

My user index view

 <% form_tag users_path, :method => 'get' do %>
   <p>
     <%= text_field_tag :search, params[:search] %>
     <%= submit_tag "Search", :name => nil %>
   </p>
 <% end %>

 <ul class="users">
   <%= render @users %>
 </ul>

Not only is the search not working correctly but when I type a name and its not there it should return all users but instead it returns an empty page, not sure if thats relevant but I thought I’d be as through as possible. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:08:22+00:00Added an answer on May 26, 2026 at 1:08 am

    i am assuming that you are using MySQL for development and heroku’s PostgreSQL for production. Normally errors like this are probably due to differences in production and development database environments.

    The problem could be the statement

    find(:all, :conditions => ['name LIKE ?', "%#{search}%"])
    

    change it to this

    find(:all, :conditions => ['name ILIKE ?', "%#{search}%"])
    

    notice the ILIKE.

    Always best to use same database in development and production, as this will prevent problems later on. Also checkout the heroku docs here. if you are using heroku. Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure what's causing the problem, but for some reason sidebar of my
For some reason, Section 1 works but Section 2 does not. When run in
I had to take my working example here. For some reason, it does not
I use some jquery to highlight search results. For some reason if i enter
For some reason the onpause method is not always getting called when my app
For some reason I never see this done. Is there a reason why not?
For some reason when I create a new namespace in Visual Studio 2008 its
$_GET['search'] = ucfirst(strtolower(str_replace(_, ,urldecode($_GET['search'])))); For some reason it's adding slashes into the string similar
I’m having some strange problem with my JS program. I had this working properly
I am using this for my password matching but it is not working can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.