New Deploy to Production, Rake db:migrate fails - ruby-on-rails

Trying to deploy a new app to production. Build the server from a base CentOS.
However, when I try to run the rake to migrate the database, i get the following error
[root#tatp tatp_store]# bundle exec rake db:migrate
rake aborted!
uninitialized constant ActiveShipping::Base
(See full trace by running task with --trace)
[root#tatp tatp_store]#
I through it might be a similar issue to the DSL issue but similar fixes do not work.
Thanks!

This issue was caused by a bug in the Spree Active Shipping, issue #26 which has been fixed in build 9d4af80

Related

Migration Errors on Heroku

I have a Rails app which I have recently pushed up to Heroku. When I try to migrate the database with:
heroku run rake db:migrate
I am getting the rake aborted! message and complains about a table that doesn't exist.
Locally, when I run the migrate command there are no issues so why is Heroku different?
I did experience this issue the last time I migrated on Heroku too - I ended up using:
heroku rake db:schema:load
to overcome the problem but I really want to get to the root of the problem so it stops happening.
Any suggestions?
EDIT: I know which migration file is at fault but is it safe to remove a file from the migrations folder?

Database issues when using RSpec for testing

I'm working on a Ruby on Rails project and trying to get RSpec working so i can write some tests. I run the following command:
bundle exec rspec spec/
to run my test. I then get the error
Migrations are pending; run 'rake db:migrate RAILS_ENV=test' to resolve this issue.
so then i run
rake db:migrate RAILS_ENV=test
and get the following error
any help would be appreciated!
The error is misleading. You should never run migrations directly on your test db. Run:
rake db:test:prepare
This post may be helpful depending on your Rails version: Rake db:test:prepare task deleting data in development database
Rails 3.2.9 may solve your issue.

Ruby on Rails Rake assets:precompile error - Command failed with status (1) - CScript Error: Execution of the Windows Script Host failed

Okay so time after time we've all seen question about Rake assets:precompile error. I've tried multiple methods, I looked at the following SO question Ruby on Rails Rake assets:precompile error and tried multiple methods of even doing the following: config.assets.compile = true and then running rake assets:precompile --trace RAILS_ENV=production. However I noticed that when I tried to do the following:
rake assets:precompile RAILS_ENV=production I got the following error:
rake aborted!
CScript Error: Execution of the Windows Script Host failed. (0x800A0007)
C:\Users\home\Desktop>cd MIUK_Portal
C:\Users\home\Desktop\MIUK_Portal>rake assets:precompile
RAILS_ENV=production C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe
C:/RailsInstaller/Ruby1.9.3/bin/rake assets:precompile:all
RAILS_ENV=production RAILS_GROUPS=assets rake aborted! 795: unexpected
token at
'C:\Users\home\AppData\Local\Temp\execjs20121221-5484-1atk9yx.js(2, 3)
Microsoft JScript runtime error: Out of memory
' (in
C:/Users/home/Desktop/MIUK_Portal/app/assets/javascripts/application.js)
Tasks: TOP => assets:precompile:primary (See full trace by running
task with --trace) rake aborted! Command failed with status (1):
[C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe C...]
Tasks: TOP => assets:precompile (See full trace by running task with
--trace)
Has anyone encountered this issue? How do you overcome this?
Update
Okay apparently from looking at the error it clearly is stating that
:\Users\home\AppData\Local\Temp\execjs20121221-5484-1atk9yx.js(2, 3)
Microsoft JScript runtime error: Out of memory
So I'm now wondering how to resolve this? Any ideas? Further to this I noticed that someone did encounter the similar issue: CS Script issue but this was unresolved:
So I am asking if anyone out there has had the same issue.
This was what I did, and it worked for me. I installed node.js first in my system, and then ran the following command bundle exec rake assets:precompile.
I was able to solve this issue by transferring the project into a Linux environment (Ubuntu) and running the bundle exec rake assets:precompile. It appeared to work, I believe this sort of issue is something to do with windows. If starting any kind of development to do with RoR stick to Linux.

Rake error fixed by bundle exec, but deployment not working

I pushed an update to my Rails app production server, and in the update there was a new database migration. I ran rake db:migrate and got the common error seen here. I ran the rake again in bundle exec bash and it was successful. But after restarting my apache server, I'm now getting the 500 Error page. This update worked fine on my localhost, and was mostly this update to the db with supporting changes in the according view and controller/routing.
I don't even know why this error appeared this time, as I have pushed db updates successfully before using only rake. Nonetheless, the rake was successful. The 500 error page only shows on pages that require that specific new ActiveRecord. Any ideas on how to debug?
EDIT: My problem was an extremely simple one. I merely forgot to include the environment with the rake:
bundle exec rake db:migrate RAILS_ENV=production
Unfortunately, it took quite a while to narrow that down, as I couldn't use IRB to check the db entries until I followed these steps.
Did you run rake db:migrate on your server? Also be sure to set the RAILS_ENV flag so your production database is updated:
rake db:migrate RAILS_ENV=production

Rails plugin: undefined method 'mattr_accessor' for Sentry:Module

I'm looking at an existing Rails project and trying to see what rake tasks exist by running rake -T. However, when I run that I get:
(in /var/www/project)
rake aborted!
undefined method `mattr_accessor' for Sentry:Module
/var/www/project/Rakefile:10
(See full trace by running task with --trace)
vendor/plugins/sentry/tasks/sentry.rake has nothing called mattr_accessor in it. What is this error message referring to?
(See full trace by running task with --trace)
Did you try running the rake command with the --trace option?
I'm afraid this resolved itself while I was working on other issues. I'm not sure exactly what the problem was, but I believe it had to do with outdated/conflicting versions of plugins and gems.

Resources