undefined method translate during Rails 2.3 -> 3.2 upgrade - ruby-on-rails-3

Working on upgrading a Rails 2.3.17 app to Rails 3.2.22.2 (running ruby 1.9.3-p551). Was able to get through the painful portion of ugprading all the gems / updating the directory structure / adding in all new/updated rails files.
The rails server is now coming up, but when i try to load up the first page, it fails with this stack trace:
NoMethodError: undefined method `translate' for # <I18n::Backend::ActiveRecord:0x007ff64dc72400>
/myapp/vendor/bundle/ruby/1.9.1/gems/i18n-0.7.0/lib/i18n/backend/chain.rb:46:in `block (2 levels) in translate'
/myapp/vendor/bundle/ruby/1.9.1/gems/i18n-0.7.0/lib/i18n/backend/chain.rb:44:in `catch'
/myapp/vendor/bundle/ruby/1.9.1/gems/i18n-0.7.0/lib/i18n/backend/chain.rb:44:in `block in translate'
/myapp/vendor/bundle/ruby/1.9.1/gems/i18n-0.7.0/lib/i18n/backend/chain.rb:43:in `each'
...
Additional notes: I have an locale.rb file in the config/initializers/ folder, which has this:
require "i18n/backend/cache"
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Memoize)
I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Flatten)
I18n::Backend::Simple.send(:include, I18n::Backend::Memoize)
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
I18n::Backend::Chain.send(:include, I18n::Backend::Cache)
I18n.backend = I18n::Backend::ActiveRecord.new
I18n.backend = I18n::Backend::Chain.new(I18n::Backend::Simple.new, I18n.backend)
My Gemfile looks like:
source "http://rubygems.org"
gem "rails", "3.2.22.2"
gem "rake", "11.1.0"
gem "a9n", "0.3.0"
gem "geoip-c"
gem "josevalim-auth_helpers"
gem "delayed_job", "~>3.0.5"
gem "mysql2"
gem "activemerchant", "1.43.3"
gem "liquid"
gem "paperclip"
gem "mechanize", "2.7.4"
gem "net-ssh", "~>2.9.4"
gem "net-sftp", "2.0.5"
gem "authlogic", :git => "git://github.com/binarylogic/authlogic.git"
gem "rd_searchlogic"
gem "rack", "~>1.4.5"
gem "activerecord-mysql2-adapter"
gem "declarative_authorization"
gem "inherited_resources"
gem "acts_as_audited"
gem "rails-indexes"
gem "geocoder"
gem "has_magic_columns"
gem "grimen-delayed_job_mailer"
gem "asset_packager"
gem "recaptcha", "0.4.0"
gem "libxml-ruby"
gem "xml-simple"
gem "haml"
gem "airbrake", "~>4.3.7"
gem "sinatra"
gem "newrelic_rpm"
gem "will_paginate"
gem "rexml-expansion-fix"
gem "hominid"
gem "money"
gem "aasm", "~>3.4.0"
gem "dalli"
gem "acts-as-taggable-on"
gem "i18n"
gem "i18n-active_record", :require => "i18n/active_record"
gem "hpricot"
gem "rest-client"
gem "nokogiri", "~>1.6.8"
gem "exact-target"
gem "pdfkit"
gem "json"
gem "savon"
gem "twilio-ruby"
gem "oj"
gem "httparty"
gem "rforce"
gem "ruby-ntlm"
gem "ffaker"
gem "simple_qs"
gem "time_difference"
gem "aws-sdk-v1"
gem "wkhtmltopdf-binary"
gem "gyoku"
gem "mime-types"
gem "highline"
gem "exifr"
gem "encryptor","~>1.3.0"
gem "docile"
gem "american_date"
gem "gon", "~>4.0.0"
gem "rmagick", "~> 2.0" # for ruby 1.x, since 2.0 it could be removed
group :staging do
gem "ruby-prof"
end
gem "capistrano", "~> 2.15"
gem "capistrano_deploy_lock"
gem "hipchat"
end
group :spreadsheet do
gem "spreadsheet"
end
group :gpg do
gem "gpgme"
end
group :mail do
gem "mail"
gem "bounce_email"
end
group :development, :staging do
gem "pry"
gem "pry-remote"
end
group :development, :test do
gem "rspec-rails", "~> 3.0.0"
gem "rspec", "~> 3.0.0"
gem "rspec-core", "~> 3.0.0"
gem "rspec-expectations", "~> 3.0.0"
gem "fabrication"
end
group :test do
gem "bourne", "~> 1.2.1", :require => false
gem "database_cleaner", "0.9.1"
gem "mocha", "0.12.7", :require => false
gem "rack-test"
gem "simplecov"
gem "timecop"
gem "test-unit", "~>3.0"
gem "shoulda-matchers", "1.0.0", :require => false
end
any ideas why it might be generating that error message ?

Related

Why is bundle update taking so long?

I am upgrading my Rails app to use Ruby 2.1 and am updating my gems. However, when I run bundle update it is taking an incredibly long time to complete (3+ hours on the last run).
Any suggestions for fixing this would be greatly appreciated.
Here is my current gemfile:
source 'http://rubygems.org'
gem 'rails', '~> 3.2.11'
gem 'mysql2', '~>0.3.10'
gem 'json', '1.7.7'
gem 'will_paginate', '~> 3.0'
gem 'carrierwave'
gem "fog", "~> 1.3.1"
gem 'gibbon'
gem 'nokogiri'
gem 'premailer-rails3'
gem 'pg'
gem 'aws-s3'
gem 'amazon-ec2'
# Use unicorn as the app server
gem 'unicorn'
gem 'sidekiq'
gem 'rufus-scheduler'
gem 'exception_notification'
gem 'haml', '>= 4.0.0.rc.1'
gem 'html2haml'
gem 'state_machine'
gem 'garb', :git => 'git://github.com/Sija/garb.git'
gem "activerecord-import", ">= 0.2.0"
gem "hashie"
gem 'draper', '~> 1.0'
gem 'dotenv-rails', :groups => [:development, :test]
gem 'airbrake'
gem 'newrelic_rpm'
gem 'devise', '~> 2.2.4'
gem 'acts_as_tenant', :git => 'git://github.com/ErwinM/acts_as_tenant.git'
gem 'bourbon'
gem 'sass'
gem 'neat'
gem 'bitters'
gem 'middleman'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'handlebars_assets', :git => 'git://github.com/leshill/handlebars_assets.git'
gem 'jquery-rails', '~> 2.0.1'
gem 'uglifier', '>= 1.0.3'
end
group :test do
#gem 'webmock'
gem 'vcr'
gem 'launchy'
gem 'database_cleaner'
gem 'capybara', '2.0.0'
gem 'shoulda'
end
group :development, :test do
gem 'faker'
gem "rspec-rails", "2.14.0"
gem "factory_girl_rails", "~> 4.0", :require => false
gem 'spork', '~> 1.0rc'
gem 'guard-livereload'
gem 'guard-jasmine'
gem 'guard-spork'
gem 'guard-rspec'
gem 'jasminerice', :git => 'git://github.com/bradphelan/jasminerice.git'
end
group :development do
gem 'rb-inotify', :require => false
gem 'rb-fsevent', :require => false
gem 'rb-fchange', :require => false
gem 'pry'
end
Here is the last result I received:
Bundler could not find compatible versions for gem "thor":
In Gemfile:
rails (~> 3.2.11) ruby depends on
railties (= 3.2.11) ruby depends on
thor (< 2.0, >= 0.14.6) ruby
jquery-rails (~> 2.0.1) ruby depends on
thor (0.14.0)
You're including gems with incompatible dependencies. You cannot have both jquery-rails ~> 2.0.1 and rails ~> 3.2.11 as they have mutually exclusive requirements for versions of the Thor gem.
I would recommend removing the explicit version requirement for jquery-rails let Rails choose the version it needs based on its dependencies.

Paperclip::Errors::NotIdentifiedByImageMagickError

I am trying to upload image with paperclip, but got this error:
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIden tifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
I found several similar cases with mine. This and this. But I didn't use gem cocaine and my image file name is 01.png (without colons).
I don't know what the problem is. Anyone?
By the way, this is my Gemfile :
gem 'rails', '3.1.3'
gem 'sass'
gem 'coffee-script'
gem 'uglifier'
gem 'devise', '2.1.2'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'paperclip'
gem 'aws-s3'
gem 'aws-sdk'
gem 's3_swf_upload'
gem 'rails-i18n', '0.7.3'
group :development, :test do
gem 'sqlite3'
gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'
gem 'better_errors'
gem 'binding_of_caller'
end
group :production do
gem 'pg'
end
gem "will_paginate", "~> 3.0.pre2"
gem "haml"
gem 'acts-as-taggable-on'
gem "friendly_id", "~> 3.2.1"
gem "simple_form"
gem 'web-app-theme', '>= 0.6.2'
gem "mobile-fu"
gem 'inherited_resources'
gem 'settingslogic'
gem 'recaptcha', :require => 'recaptcha/rails'
gem 'mechanize'
gem 'nokogiri'
EDIT
It works without style in paperclip config.
It works now. The problem is, I have not intalled Imagemagick in my pc. Now since I installed and gave the path. It works like a charm :)

Could not update rails

When I do bundle update rails, I get this error:
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
rails (= 3.2.11) x86-mingw32 depends on
activesupport (= 3.2.11) x86-mingw32
activesupport (3.1.0)
here is my gemFile, any help is apprecaited :)
source 'http://rubygems.org'
gem 'rails' , '3.2.11'
gem "heroku"
gem 'thin'
gem 'devise'#, '1.5.2'
gem 'will_paginate', '~> 3.0.2'
#gem 'nested_form', :git => 'git://github.com/fxposter/nested_form.git'
gem "simple_form"
gem "cancan"
gem 'kaminari'
gem 'foreigner'
gem "cocoon"
gem 'client_side_validations'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
gem "jquery-rails"
gem "validate_url", "~> 0.2.0"
gem 'pg', :group => [:production]
gem 'haml'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test, :development do
gem 'sqlite3'
gem 'turn', :require => false
gem "rspec-rails", "2.7"
#gem "rspec"
gem "spork", "> 0.9.0.rc"
gem 'guard-spork'
#gem "webrat", "~> 0.7.3"
gem 'rb-fsevent' # Not mandatory for guard to work, which is why it's not a dependency, but it is an optimization
#gem "guard-spork"
#gem 'minitest'
gem "factory_girl_rails", "~> 1.2"
#gem "webrat-rspec-rails"
gem "mocha"
gem 'capybara' #, :git => 'git://github.com/jnicklas/capybara.git'
gem 'database_cleaner'
gem 'launchy'
gem "capybara-webkit"
#gem 'rspec-multi-mock', :git => 'git://github.com/endeepak/rspec-multi-mock.git'
end
group :test do
#gem 'ruby-debug19', :require => 'ruby-debug'
end
gem 'execjs'
gem 'therubyracer'
First of all you have to delete Gemfile.lock
then update Gemfile to include rails 3.2.11
go to project directory
run bundle install
This may solve your problem

Unable to run growl notifications and gem growl_notify throws errors

I am unable to get growl notifications when i run $guard
Do i need any particular version for growl_notify?
Growl version = 1.2
Here is my gem file.
gem 'rails', '3.1.3'
gem 'sqlite3'
group :development, :test do
gem 'rspec-rails'
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git'
gem 'launchy'
gem 'database_cleaner'
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
gem 'guard-rspec'
gem 'guard-livereload'
end
gem 'growl'
group :test do
gem 'guard-spork'
end
Error message when i install/ pub growl_notify in gemfile
JP:guard2 jayparteek$ guard
/Users/jayparteek/.rvm/gems/ruby-1.9.2-head#guard2/gems/rb-appscript-0.6.1/lib/appscript.rb:542:in `_send_command': CommandError (Appscript::CommandError)
OSERROR: -10000
MESSAGE: Apple event handler failed.
COMMAND: app("/Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app").register({:all_notifications=>["success", "pending", "failed", "notify"], :as_application=>"Guard", :default_notifications=>"notify"})
from /Users/jayparteek/.rvm/gems/ruby-1.9.2-head#guard2/gems/rb-appscript-0.6.1/lib/appscript.rb:642:in `method_missing'
Make sure you are running Growl 1.3.xx
In your Gemfile remove gem 'growl' and in your :test group add gem 'ruby_gntp' then run
$ gem uninstall growl_notify
$ bundle install
Should use following gemfile, with rails 3.1.3 & Growl ver 1.3.1
gem 'rails', '3.1.3'
gem 'sqlite3'
group :development, :test do
gem 'rspec-rails'
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git'
gem 'launchy'
gem 'database_cleaner'
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
gem 'guard-rspec'
# gem 'guard-livereload'
end
group :test do
gem 'guard-spork'
gem 'ruby_gntp'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
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-debug19', :require => 'ruby-debug'

Rails 3 queries - wrong number of arguments (1 for 0)

I'm currently converting my 2.3.8 rails app to 3.1.
Error:
wrong number of arguments (1 for 0)
app/controllers/application_controller.rb:22:in `footer'
Code:
#system_message = Constant.where(:key => "system_message").first
This error occurs with the first and all methods, on any model.
Even with these:
Episode.where(:id => 1).first
Episode.first
Episode.all
Setup:
Ruby 1.9.2
Rails 3.1.1.rc3
Gemfile:
source "http://rubygems.org"
source "http://gemcutter.org/"
source "http://gems.github.com/"
#Main
gem "rails", "3.1.1.rc3"
#gem "rails", :git => "git://github.com/rails/rails.git"
#System
gem "mysql2"
gem "therubyracer", require: "v8"
#Tools
gem "capistrano"
gem "hoptoad_notifier"
gem "whenever"
#Application
gem "jquery-rails"
gem "hpricot"
gem "ar-extensions"
gem "gravtastic"
gem "will_paginate"
gem "time_diff"
gem "has_permalink"
#Email
gem "adzap-ar_mailer"#, :lib => "action_mailer/ar_mailer"
gem "ambethia-smtp-tls"#, :lib => "smtp-tls"
#Devise
gem "devise"
gem "warden"
group :assets do
gem "sass-rails", "~> 3.1.4"
gem "coffee-rails", "~> 3.1.1"
gem "uglifier", ">= 1.0.3"
end
group :development do
gem "bullet"
end
group :test do
gem "turn", :require => false
end
Found it!
The gem "ar-extensions" isn't supported for Rails 3.
Changed to the "activerecord-import" gem.