Ruby 2.4.1 - warning: constant ::Fixnum is deprecated [duplicate] - ruby-on-rails

This question already has answers here:
Ruby 2.4 and Rails 4 stack level too deep (SystemStackError)
(3 answers)
Closed 5 years ago.
I'm new to StackOverflow and Rails, so I am hoping this is not too naive a question. I am trying to run my application locally using bin/rails server. When I type that, I receive the following trace:
=> Booting Puma
=> Rails 4.2.5 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
/Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
Exiting
/Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:125:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /Users/name/.rvm/gems/ruby-2.4.1/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
... 5603 levels...
from /Users/name/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/name/spending-tracker-master/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
I do not believe I can ignore it as stated here (warning: constant ::Fixnum is deprecated When generating new model) because it won't open the application locally.
Could someone help?
Thank you!
Ben

Ruby 2.4 unified Fixnum and Bignum into a single class Integer. When Rails (ActiveSupport's core extensions to be precise) attempts to monkey-patch the aforementioned classes, an error occurs.
This was fixed in Rails 5, and the fix was also backported to Rails 4.2 with version 4.2.8:
Hi everyone,
I am happy to announce that Rails 4.2.8 has been released.
This is the first version of the 4.2 series that officially support
Ruby 2.4.
All you have to do is upgrading Rails from 4.2.5 to Rails 4.2.8.

Related

Ruby Upgrade Issues

I upgraded my ruby gem and rails to the latest version. Fixed all the dependencies but still, I am unable to start my rails application.
When I try rails s, I get the below error. I am not sure how to fix this. Any help would be appreciated.
=> Booting WEBrick
=> Rails 4.1.7 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
/Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
Exiting
Traceback (most recent call last):
5437: from bin/rails:3:in `<main>'
5436: from bin/rails:3:in `load'
5435: from /Users/sri/Documents/imcmarketplace/bin/spring:16:in `<top (required)>'
5434: from /Users/sri/Documents/imcmarketplace/bin/spring:16:in `require'
5433: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
5432: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
5431: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
5430: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
... 5425 levels...
4: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
3: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
2: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
1: from /Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
/Users/sri/.rvm/gems/ruby-2.5.1/gems/activesupport-4.1.7/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)
Thanks
Sri
I think the problem is related to your ruby and rails version and I think you need to downgrade ruby version or upgrade the rails version
for more check here Ruby 2.4 and Rails 4 stack level too deep (SystemStackError)
To resolve this issue goto Gemfile use gem 'spring' don't add the version of the spring. Then do the bundle install. Still, you have an issue remove the Gemfile.lock then do the bundle install. I hope this will help you.

Rails Server fails to start on Ubuntu (was on MAC before), directly exiting

following my question here, I now set up a linux system trying to get it running. To repeat:
I have a website developed in RoR v 4.2.4 on a MAC OS X system
We need to adapt this website a bit and then deploy it on a server (the new linux system can be used later for the server)
This time I could update all the gems without a problem. bundle check says that all dependencies are satisfied. Unfortunately when i try to start the server to test the website with rails server the following error occours
Array values in the parameter to `Gem.paths=` are deprecated.
Please use a String or nil.
An Array ({"GEM_PATH"=>["/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0", "/home/XWebsite/.gem/ruby/2.4.0"]}) was passed in from bin/rails:3:in `load'
/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thread_safe-0.3.5/lib/thread_safe/cache.rb:155: warning: constant ::Fixnum is deprecated
=> Booting Puma
=> Rails 4.2.4 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thread_safe-0.3.5/lib/thread_safe/cache.rb:155: warning: constant ::Fixnum is deprecated
/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
Exiting
/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:124:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
... 4088 levels...
from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /home/XWebsite/XWebsite/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
We also tried Webrick as the server but the error is the same with the exception of: 'Booting WEBrick'
Creating/Developping a new website with rails new blog and running the server works perfectly on the linux system.
Thanks a lot for your help in advance
bundle update spring
bundle exec spring binstub --remove --all
bundle exec spring binstub --all

Adding custom template to mail_form gem

I'm attempting to follow the documentation for the Mail_form gem to add a custom email template. The documentation states:
To customize the e-mail template that is used create a file called contact.erb in app/views/mail_form. Take a look at lib/mail_form/views/mail_form/contact.erb in this repo to see how the default template works.
Also, I found this issue in the repo and did the same:
I created a mail_for.rb file in initializers and added MailForm::Notifier.template_root = File.join(Rails.root, "app", "views"), to the file.
I created a mail_form directory in views and added a contact.erb file and copied the default template to it.
However, when I restart the server I get the following error:
Booting WEBrick
=> Rails 4.2.5 application starting in development on http://localhost:3000
=> Run rails server -h for more startup options
=> Ctrl-C to shutdown server Exiting /Users/Tony/.rvm/gems/ruby-2.2.1/gems/actionmailer-4.2.5/lib/action_mailer/base.rb:569:in
method_missing': undefined methodtemplate_root=' for
MailForm::Notifier:Class (NoMethodError) from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/config/initializers/mail_form.rb:1:in
<top (required)>' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:inload' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in block in load' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:inload_dependency' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in load' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/engine.rb:652:in
block in load_config_initializer' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/notifications.rb:166:in
instrument' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/engine.rb:651:in
load_config_initializer' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/engine.rb:616:in
block (2 levels) in <class:Engine>' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/engine.rb:615:in
each' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/engine.rb:615:in
block in <class:Engine>' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/initializable.rb:30:in
instance_exec' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/initializable.rb:30:in
run' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/initializable.rb:55:in
block in run_initializers' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in
block in tsort_each' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in
block (2 levels) in each_strongly_connected_component' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:420:in
block (2 levels) in each_strongly_connected_component_from' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in
each_strongly_connected_component_from' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:419:in
block in each_strongly_connected_component_from' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/initializable.rb:44:in
each' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/initializable.rb:44:in
tsort_each_child' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:413:in
call' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:413:in
each_strongly_connected_component_from' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in
block in each_strongly_connected_component' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in
each' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in
call' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in
each_strongly_connected_component' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in
tsort_each' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in
tsort_each' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/initializable.rb:54:in
run_initializers' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/application.rb:352:in
initialize!' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/config/environment.rb:5:in
' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/config.ru:3:in
require' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/config.ru:3:in
block in ' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in
instance_eval' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in
initialize' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/config.ru:in
new' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/config.ru:in
' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in
eval' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in
new_from_string' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:40:in
parse_file' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:299:in
build_app_and_options_from_config' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:208:in
app' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/server.rb:61:in
app' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:336:in
wrapped_app' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/server.rb:139:in
log_to_stdout' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/server.rb:78:in
start' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:80:in
block in server' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in
tap' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in
server' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in
run_command!' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands.rb:17:in
' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/bin/rails:9:in
require' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/bin/rails:9:in
' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in
load' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in
call' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/lib/spring/client/command.rb:7:in
call' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/lib/spring/client.rb:28:in
run' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/bin/spring:49:in
<top (required)>' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/lib/spring/binstub.rb:11:in
load' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/lib/spring/binstub.rb:11:in
<top (required)>' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/bin/spring:13:in
require' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/bin/spring:13:in
<top (required)>' from bin/rails:3:inload' from bin/rails:3:in
`'
Everything works when I remove the code in the mail_form.rb file, but I want to customize the mail notification to my liking. The error says undefined method template_root=' for MailForm::Notifier:Class, but I don't know what it means. I'm still learning so this error is a little over my head, Any help would be greatly appreciated! Thanks!
I was faced with the same problem. It was quite frustrating that their documentation is lacking information about custom template. It's so nebulous. I need to give credit to a colleague of mine for finding a quick solution. He is way more skilled than me in Ruby.
Here's what he did:
Remove/delete the mail_form.rb file in initializers. My colleague thinks the gem already does this by default, and after testing this theory I guess he was right. So you don't need the file.
Expend your External Libraries folder in your project tree and find the mail_form folder. I'm using RubyMine so I don't know if your software will show this. tell me if if it doesn't and I will update my answer and paste the initial template code.
Inside the mail_form folder, expand and access the following file lib>mail_form>views>mail_form>contact.erb. This .erb file is the initial template used by the gem.
Copy/paste the content of the file accessed above into the contact.erb file that you previously created inside your mail_form directory in your views directory. This will become your custom template.
Once this is done, you now have full control over the email template, so modify the code to your liking.

active_support/secure_random LoadError

I am migrating my rails app from Rails 2.3 to 3.2. I have ActiveSupport 3.2 dependency but at app startup I keep getting following error. I am not using active_support/secure_random anywhere in my code. Can someone please help me solve this problem?
Error Logs -
[Thu Sep 04 22:52:56.014721 2014] [:warn] [pid 1440] FastCGI: server "AppRootFolder/bin/rails_dispatch.fcgi" (pid 1554) terminated by calling exit with status '1'
AppRootFolder/ruby1.9/gems/1.9.1/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:317:in rescue in depend_on': No such file to load -- active_support/secure_random (LoadError) from AppRootFolder/ruby1.9/gems/1.9.1/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:312:independ_on'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:225:in require_dependency' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/engine.rb:444:inblock (2 levels) in eager_load!'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/engine.rb:443:in each' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/engine.rb:443:inblock in eager_load!'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/engine.rb:441:in each' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/engine.rb:441:ineager_load!'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/application/finisher.rb:53:in block in <module:Finisher>' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/initializable.rb:30:ininstance_exec'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/initializable.rb:30:in run' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/initializable.rb:55:inblock in run_initializers'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/initializable.rb:54:in each' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/initializable.rb:54:inrun_initializers'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/application.rb:136:in initialize!' from AppRootFolder/ruby1.9/gems/1.9.1/gems/railties-3.2.19/lib/rails/railtie/configurable.rb:30:inmethod_missing'
from AppRootFolder/var/rails-root/config/environment.rb:4:in <top (required)>' from AppRootFolder/ruby1.9/1.9.1/rubygems/custom_require.rb:36:inrequire'
from AppRootFolder/ruby1.9/1.9.1/rubygems/custom_require.rb:36:in require' from AppRootFolder/var/rails-root/config.ru:3:inblock in '
from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in instance_eval' from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:ininitialize'
from AppRootFolder/var/rails-root/config.ru:in new' from AppRootFolder/var/rails-root/config.ru:in'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in eval' from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:inparse_file'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in app' from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:inwrapped_app'
from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in start' from AppRootFolder/ruby1.9/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:137:instart'
from AppRootFolder/bin/rails_dispatch.fcgi:20:in `'
ActiveSupport::SecureRandom was removed from rails 3.2 because rails 3.2 requires ruby 1.8.7 already has a builtin SecureRandom.
Replace any requires with
require 'securerandom'
And use SecureRandom instead.
If you're not using SecureRandom directly then you are probably using a gem that does, for example old versions of devise.

Unable to deploy on Heroku after migrating rails app from 3.2.3 to rails 4.0.0.rc2

I have recently migrated an existing rails 3.2.3 app to rails 4.0.0.rc2. I have made all the necessary changes and have been able to make it work fine on my local. But when I push this to heroku - "git push heroku master", it says failed to push some refs. The follwoing is the stack trace -
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in initialize'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:825:innew'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in connect'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:542:ininitialize'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in new'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:41:inpostgresql_connection'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in new_connection'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/abstract/connection_pool.rb:450:incheckout_new_connection'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in acquire_connection'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/abstract/connection_pool.rb:356:inblock in checkout'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in checkout'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:inblock in connection'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in connection'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_adapters/abstract/connection_pool.rb:546:inretrieve_connection'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_handling.rb:79:in retrieve_connection'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/connection_handling.rb:53:inconnection'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0.rc2/lib/active_record/model_schema.rb:203:in table_exists?'
/tmp/build_uqaojzpp3n68/lib/custom_active_record/domain_constants_pool.rb:13:inevaluate_constants'
/tmp/build_uqaojzpp3n68/app/models/user_type.rb:4:in <class:UserType>'
/tmp/build_uqaojzpp3n68/app/models/user_type.rb:1:in'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:in require'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:inblock in require'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:213:in load_dependency'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:inrequire'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:329:in require_or_load'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:462:inload_missing_constant'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:183:in const_missing'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:494:inload_missing_constant'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:183:in const_missing'
/tmp/build_uqaojzpp3n68/app/models/user.rb:13:in'
/tmp/build_uqaojzpp3n68/app/models/user.rb:1:in <top (required)>'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:inrequire'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:in block in require'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:213:inload_dependency'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:in require'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:329:inrequire_or_load'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:462:in load_missing_constant'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:183:inconst_missing'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/inflector/methods.rb:226:in const_get'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/inflector/methods.rb:226:inblock in constantize'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/inflector/methods.rb:224:in each'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/inflector/methods.rb:224:ininject'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/inflector/methods.rb:224:in constantize'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:534:inget'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:565:in constantize'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/devise-3.0.0.rc/lib/devise.rb:274:inget'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/devise-3.0.0.rc/lib/devise/mapping.rb:77:in to'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/devise-3.0.0.rc/lib/devise/mapping.rb:72:inmodules'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/devise-3.0.0.rc/lib/devise/mapping.rb:89:in routes'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/devise-3.0.0.rc/lib/devise/mapping.rb:156:indefault_used_route'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/devise-3.0.0.rc/lib/devise/mapping.rb:66:in initialize'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/devise-3.0.0.rc/lib/devise.rb:308:innew'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/devise-3.0.0.rc/lib/devise.rb:308:in add_mapping'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/devise-3.0.0.rc/lib/devise/rails/routes.rb:208:inblock in devise_for'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/devise-3.0.0.rc/lib/devise/rails/routes.rb:207:in each'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/devise-3.0.0.rc/lib/devise/rails/routes.rb:207:indevise_for'
/tmp/build_uqaojzpp3n68/config/routes.rb:55:in block in <top (required)>'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0.rc2/lib/action_dispatch/routing/route_set.rb:316:ininstance_exec'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0.rc2/lib/action_dispatch/routing/route_set.rb:316:in eval_block'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0.rc2/lib/action_dispatch/routing/route_set.rb:294:indraw'
/tmp/build_uqaojzpp3n68/config/routes.rb:1:in <top (required)>'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:222:inload'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:222:in block in load'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:213:inload_dependency'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:222:in load'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/application/routes_reloader.rb:40:inblock in load_paths'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/application/routes_reloader.rb:40:in each'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/application/routes_reloader.rb:40:inload_paths'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/application/routes_reloader.rb:16:in reload!'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/application/routes_reloader.rb:26:inblock in updater'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/file_update_checker.rb:75:in call'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/file_update_checker.rb:75:inexecute'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/application/routes_reloader.rb:27:in updater'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/application/routes_reloader.rb:6:inexecute_if_updated'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/application/finisher.rb:69:in block in <module:Finisher>'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/initializable.rb:30:ininstance_exec'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/initializable.rb:30:in run'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/initializable.rb:55:inblock in run_initializers'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/initializable.rb:54:in run_initializers'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/application.rb:215:ininitialize!'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/railtie/configurable.rb:30:in method_missing'
/tmp/build_uqaojzpp3n68/config/environment.rb:5:in'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:in require'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:inblock in require'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:213:in load_dependency'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.rc2/lib/active_support/dependencies.rb:228:inrequire'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/application.rb:189:in require_environment!'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.rc2/lib/rails/application.rb:249:inblock in run_tasks_blocks'
/tmp/build_uqaojzpp3n68/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:54:in `block (2 levels) in define'
Tasks: TOP => environment
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby/Rails app
I use postgres on my local also, and its working fine. This app was previously deployed on heroku. I have added ruby 2.0.0 in Gemfile and the logs indicate that they are using ruby 2.0.0. I am not sure how to debug this. Is there any other change required to migrate existing app on heroku to 4.0.
Any help would be appreciated.
Thanks in advance.
Your problem is during slug compilation the environment variables are not available to your app. Try installing the user-env-compile labs feature.

Resources