Migration silent error - ruby-on-rails-3

When I run rake db:migrate, I don't get a response.
Doing a trace, I get the following but I am not sure how to interpret it:
$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
I am running rails 3.0.10.

As coreyword suggested, perhaps there are no new migrations to run.
The rake db:migrate command will exit silently when there's nothing (new) to do.

Related

Assets not showing up in production with "rails s" command with Chrome browser

None of my assets, such as images, javascripts, and styling features are showing up when I run the following command:
RAILS_ENV=production rails s
Then I go to http://localhost:3000 and the application comes up, but has no styling at all.
I did precompile the assets:
➜ myapp git:(master) ✗ bundle exec rake assets:precompile --trace
Invoke assets:precompile (first_time)
Execute assets:precompile
/Users/me/.rvm/rubies/ruby-1.9.3-p545/bin/ruby /Users/me/.rvm/gems/ruby-1.9.3-p545#myapp/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
Invoke assets:precompile:all (first_time)
Execute assets:precompile:all
Invoke assets:precompile:primary (first_time)
Invoke assets:environment (first_time)
Execute assets:environment
Invoke environment (first_time)
Execute environment
Invoke tmp:cache:clear (first_time)
Execute tmp:cache:clear
Execute assets:precompile:primary
Invoke assets:precompile:nondigest (first_time)
Invoke assets:environment (first_time)
Execute assets:environment
Invoke environment (first_time)
Execute environment
Invoke tmp:cache:clear (first_time)
Execute tmp:cache:clear
Execute assets:precompile:nondigest
This works just fine in Safari, can't figure out why Chrome won't load the stuff. I cleared out the browser cache also.
In config/environments/production.rb, make sure your application is configured to serve static assets:
config.serve_static_assets = true
By default, Rails assumes that your static assets will be served elsewhere (e.g. Apache, Nginx, etc.)

Cap deploy doesn't work all the sudden; something to do with FactoryGirl and assets

I've been cap deploying my app all throughout it development, and this last time I tried to deploy it, it didn't work. Here's what happened:
* executing `deploy:assets:precompile'
* executing "cd /var/www/oneteam/releases/20121006153136 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
servers: ["electricsasquatch.com"]
[electricsasquatch.com] executing command
** [out :: electricsasquatch.com] rake aborted!
** [out :: electricsasquatch.com] uninitialized constant OneTeam::Application::FactoryGirl
** [out :: electricsasquatch.com]
** [out :: electricsasquatch.com] (See full trace by running task with --trace)
It looks like it failed on the deploy:assets:precompile command. I don't get why that command would have tried to do anything with FactoryGirl, though. Any ideas?
It is not that something is wrong with deploy:assets:precompile task, but something is wrong with rake task that is using FactoryGirl. Even if you place a syntax error let us say in lib/tasks/first.rake and you execute task from lib/tasks/second.rake for instance rake second the rake will scream with rake aborted!. Even rake -T will not work. So there is rake task that is trying to use FactoryGirl but FactoryGirl is not included.
I had this in config/application.rb:
FactoryGirl.define do
sequence(:random_string) { |s| ('a'..'z').to_a.shuffle[0, 30].join }
end
I changed it to this:
if Rails.env != "production"
FactoryGirl.define do
sequence(:random_string) { |s| ('a'..'z').to_a.shuffle[0, 30].join }
end
end
The problem went away.

RoR: why doesn't rake db:migrate output anything?

I added add_column :microposts, :type, :string to one of my db migrations (not the most recent one if that matters). and also ran rake db:reset. So I have definitely made changes. But now if I run rake db:migrate or bundle exec rake db:migrate, it doesn't output anything. If I run trace...
alex#alex-ThinkPad-T410:~/rails_projects/final2$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:dump
You wrote:
I added add_column :microposts, :type, :string to one of my db
migrations (not the most recent one if that matters).
This suspiciously sounds, as if you just added the text into the migration file. That won't work. The migration state machine doesnt notice changes in the actual text files. Please check
rake db:migrate:status
You should instead create a new migration
rails g migration AddTypeToMicropost type:string
and then run rake again

CScript Error: Execution of the Windows Script Host failed - Rails rake assets:precompile

I am deploying rails project on heroku. When I use rake assets:precompile it gives following error -
rake aborted!
CScript Error: Execution of the Windows Script Host failed. (0x800A0007)
(in c:/Rails Projects/sheets_vip_rails/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:/Ruby193/bin/ruby.exe c:/Ruby193/bin/rak...]
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Thanks for any help.

Resque hates kaminari dsl method paginates_per

So I'm converting my Admin mailers to use Resque and execute in the background.
When I ran:
rake resque:work QUEUE='*' --trace
I get this:
$ rake resque:work QUEUE='*' --trace (in /my/directory)
** Invoke resque:work (first_time)
** Invoke resque:preload (first_time)
** Execute resque:preload rake aborted! undefined method `paginates_per' for #<Class:0x000000045ba1b8>
which traces back to my Micropost model that default to 10 micropost per page using kaminari's dsl method paginates_per:
class Micropost < ActiveRecord::Base
.
.
.
paginates_per 10
How do I get rake to stop puking without moving the DSL method?