1

I have an app and I use there the autocomplete gem. It works me great on localhost. But when I deploy this app to Heroku, the autocomplete plugin doesn't works me. No errors in Firebug, just nothing.

Does anyone an idea, where could be a problem? This is how look my Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.1.2'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'mysql2'
gem "rvm", "~> 1.9.2"
gem 'authlogic'
gem "rake", "0.8.7"
gem 'json'
gem "declarative_authorization", "~> 0.5.3"
gem "ancestry", "~> 1.2.4"
gem "taps", "~> 0.3.23"
gem "paperclip", "~> 2.4.5"
gem 'aws-s3'
gem "awesome_print", "~> 1.0.1"
gem 'actionmailer'
gem 'wkhtmltopdf-binary'
gem 'rails3-jquery-autocomplete'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.1.5.rc.2'
  gem 'coffee-rails', '~> 3.1.1'
  gem 'uglifier', '>= 1.0.3'
end

group :production do
  gem 'therubyracer-heroku', '0.8.1.pre3'
  gem 'pg'
end



gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug'
4
  • Anything on the server log files? Commented Dec 30, 2011 at 1:00
  • I just precompiled assets and it's "working" - I am getting now the error ActiveRecord::StatementInvalid (PGError: ERROR: function lower(integer) does not exist - but how can I to write my own search method for this gem ? Commented Dec 30, 2011 at 1:24
  • you should create a separate question, but it depends how you're using this. It implies you're trying to search on an integer column? Commented Dec 30, 2011 at 1:39
  • @MatthewRudy I created a new topic , because this is a new problem. I think there is needed a separate query, but I don't know where the query put it. Commented Dec 30, 2011 at 1:46

2 Answers 2

2

For anyone coming here from Google - I searched and searched - finally - in my case the answer turned out the be the include directive in app/assets/application.js:

// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
**//= require jquery_ujs**
//= require excanvas.min
//= require bootstrap.min

I added the ** fyi

When you take OUT that line, because you have jquery-rails gem installed (you do have jquery-rails installed right?) then run:

RAILS_ENV=production bundle exec rake assets:precompile:all

At your shell in your Rails app's root directory (I'm spelling everything out here cause a lot of times people don't explicitly state everything in their comments!)

You shouldn't get any errors - it's that :all at the end that was revealing the jquery / jquery_ujs errors.

If you just type:

bundle exec rake assets:precompile

You probably won't get any errors - but jquery won't work either (this is the part that tripped me out).

When I found another comment on SO that said to add :all and it would reveal jquery erros - viola! - it told me stuff wasn't right.

So finally removing the jquery_ujs (which was documented as DON'T REMOVE THIS ON PAIN OF DEATH in other places...) and compiling and then running unicorn as though I'm in production - it works great.

The bonus of course is now that you have your assets compiled you can throw that folder up on Amazon S3, open a CloudFront account, use something like asset_sync gem - and reduce the load even more on Heroku's dynos.

BALLER

Sign up to request clarification or add additional context in comments.

Comments

0

In my case i had to delete this plugin from my gem file gem 'sprockets_better_errors'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.