Note that there are some explanatory texts on larger screens.

plurals
  1. POsearch working in development but not in production
    primarykey
    data
    text
    <p>I just launched my rails app with heroku (<a href="http://fast-reaches-9399.herokuapp.com/" rel="nofollow">http://fast-reaches-9399.herokuapp.com/</a>). The search works on my local development environment, but not in the production environment. Could this be because of a problem with postgres vs. sqlite?</p> <p>I did this:</p> <pre><code>group :development do gem 'sqlite3', '1.3.5' end group :production do gem 'pg', '0.12.2' end </code></pre> <p>just like in this tutorial (<a href="http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec-heroku_setup" rel="nofollow">http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec-heroku_setup</a>).</p> <p>Here is my relevant code for searching. I used this (<a href="http://railscasts.com/episodes/37-simple-search-form" rel="nofollow">http://railscasts.com/episodes/37-simple-search-form</a>) for help.</p> <p>/search.html.erb</p> <pre><code>&lt;h2&gt;Results:&lt;/h2&gt; &lt;ul&gt; &lt;% @colleges.each do |college| %&gt; &lt;li&gt;&lt;%= link_to "#{college.name}", "#{college.url}" %&gt;&lt;/li&gt; &lt;% end %&gt; &lt;/ul&gt; </code></pre> <p>application.html.erb (my layout file)</p> <pre><code>&lt;%= form_tag("/search", :method =&gt; 'get') do -%&gt; &lt;li id="search"&gt; &lt;%= search_field_tag :search, params[:search] %&gt;&lt;/li&gt; &lt;% end -%&gt; </code></pre> <p>static_pages_controller.rb</p> <pre><code>def search @colleges = College.search(params[:search]) end </code></pre> <p>college.rb</p> <pre><code>def self.search(search) if search find(:all, :conditions =&gt; ['name LIKE ?', "%#{search}%"]) else find(:all) end end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload