Issues implementing Rspec with Rails3 from tutorial - ruby-on-rails-3

I am a newbie to Rails 3 and Rspec. Kindly excuse my being a novice.
I am trying to implement RSpec with Rails 3. I am using Rails 3.0.3 with Ruby 1.9.2 on Ubuntu 10.04 os. I am using rspec 2.5 gem and rspec-rails 2.5 gem.
I am referring to the following tutorial:-
http://www.railsfire.com/article/rspec-behaviour-driven-development-testing-framework
This tutorial is implemented on Rails 2.x with an older version of rspec and rspec-rails.
I tried to implement exactly the same tutorial with my configuration, but I have run into some issues. I am unable to figure out what I must have done wrong.
I am sure about one thing that I am not using the rails_scaffold generator as used in this tutorial. Instead of using the rails_scaffold generator, I made use of the following command rails g scaffold post title:string body:text
I don't seem to have it(rspec_scaffold) in my list of generators which as part of Rails 3 and the additional ones that will come with Rspec.
The error I am getting is :-
mohnish#mohnish-desktop:~/rails_testing/10Mar11/rspec_demo5$ rake spec
(in /home/mohnish/rails_testing/10Mar11/rspec_demo5)
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
(See full trace by running task with --trace)
mohnish#mohnish-desktop:~/rails_testing/10Mar11/rspec_demo5$ rake spec --trace
(in /home/mohnish/rails_testing/10Mar11/rspec_demo5)
** Invoke spec (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:429:in `block (3 levels) in <top (required)>'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/home/mohnish/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain'
/home/mohnish/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:460:in `block (3 levels) in <top (required)>'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/home/mohnish/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain'
/home/mohnish/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/home/mohnish/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
mohnish#mohnish-desktop:~/rails_testing/10Mar11/rspec_demo5$
Any suggestions on what I must be doing wrong and how to fix the same. Kindly help.
Thank you very much.

I made a fundamental mistake, I realized that I always made use of rake db:create, and rake db:migrate. This would set things for me with
Development Environment. For the test enviroment, I had to use rake db:test:prepare or rake db:migrate with appropriate syntax to reflect
the migrations in the Test Environment.

Related

Rake command not working while trying to read email from gmail server using IMAP

I am running below rake command to read email using IMAP from use_redmine.bat
in which my working directory is \Bitnami\redmine-3.3.3-1\apps\redmine\htdocs>
and the command is
rake redmine:email:receive_imap RAILS_ENV="production" host=imap.gmail.com \
port=993 username=xxxx password=xxxx ssl=1 tracker=feature unknown_user=accept \
allow_override=all --trace
Note:
It is working in my local system and I am successfully able to create feature and bug from email conduit. But not working on the server(another system).
Things I have tried:
Disabled firewall on the server in case if it is blocking.
Disabled antivirus on the server in case if it is blocking.
Installed the same setup in both machine local and the server.
Installed the same setup with the same windows version.
Followed the same setup steps in both machine local and the server like.
-Installing bitnami-redmine-3.3.3-1-windows-installer.exe.
-running bundle install.
-running bundle install --no-deployment.
-running rake command.
Also, have checked that port is listening by net sh command.
**Output of the command:**
** Invoke redmine:email:receive_imap (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:email:receive_imap
rake aborted!
OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/2.3.0/net/imap.rb:1492:in `connect'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/2.3.0/net/imap.rb:1492:in `start_tls_session'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/2.3.0/net/imap.rb:1085:in `initialize'
C:/Bitnami/redmine-3.3.3-1/apps/redmine/htdocs/lib/redmine/imap.rb:30:in `new'
C:/Bitnami/redmine-3.3.3-1/apps/redmine/htdocs/lib/redmine/imap.rb:30:in `check'
C:/Bitnami/redmine-3.3.3-1/apps/redmine/htdocs/lib/tasks/email.rake:117:in `block (4 levels) in <top (required)>'
C:/Bitnami/redmine-3.3.3-1/apps/redmine/htdocs/app/models/mailer.rb:430:in `with_synched_deliveries'
C:/Bitnami/redmine-3.3.3-1/apps/redmine/htdocs/lib/tasks/email.rake:116:in `block (3 levels) in <top (required)>'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
C:/Bitnami/redmine-3.3.3-1/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
C:/Bitnami/redmine-3.3.3-1/ruby/bin/rake:22:in `load'
C:/Bitnami/redmine-3.3.3-1/ruby/bin/rake:22:in `<main>'
Tasks: TOP => redmine:email:receive_imap
Any help is so much appreciated.!
If you are using Gmail as the outbound email server and you are not able to send email correctly, Google may be blocking sign-in attempts from your apps or devices. Depending on whether or not you use Google Apps, the steps to correct this will differ:
For Google Apps users
For other Google users

Ruby on rails + Tiny TDS not connecting to sql epxress

I'm trying to get a rails app to connect to a SQL Express instance. I'm working in a windows environment.
I don't want to setup a DSN so I went with Tindy TDS. Unfortunately, I can't get it to work.
When I execute
rake db:migrate
I see
rake db:migrate
rake aborted!
closed connection
C:/site/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
and when I run the trace, I see
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
closed connection
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-3.2.10/lib/active_record/connection_adapters/sqlserver_adap
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-3.2.10/lib/active_record/connection_adapters/sqlserver_adap
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-3.2.10/lib/active_record/connection_adapters/sqlserver_adap
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-3.2.10/lib/active_record/connection_adapters/sqlserver_adap
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-3.2.10/lib/active_record/connection_adapters/sqlserver_adap
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-3.2.10/lib/active_record/connection_adapters/sqlserver_adap
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-sqlserver-adapter-3.2.10/lib/active_record/connection_adapters/sqlserver_adap
'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specificatio
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specificatio
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/model_schema.rb:308:in `clear_cache!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/railtie.rb:97:in `block (2 levels) in <class:Railtie
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:418:in `_run__107948286__prepare__477
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
C:/rorblog/rorblog/config/environment.rb:5:in `<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:103:in `require_environment!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in `call'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in `block in execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in `execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:187:in `block in invoke_prerequisites'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:185:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:185:in `invoke_prerequisites'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:152:in `invoke'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:143:in `invoke_task'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `block (2 levels) in top_level'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `block in top_level'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:73:in `block in run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
C:/Ruby193/bin/rake:23:in `load'
C:/Ruby193/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate => environment
My database.yml is
development:
adapter: sqlserver
database: MyDatabase
dataserver: localhost\SQLEXPRESS
mode: dblib
username: sa
password: "1234"
In the trace file I see "method missing" but no idea if thats the problem or if it's something else.
Updated my environment.rb file to add error catching
begin
MySite::Application.initialize!
rescue Exception => ex
puts '--------------------'
puts ex.message
puts '--------------------'
end
and I can see that TinyTDS is giving an error
--------------------
Unable to connect: Adaptive Server is unavailable or does not exist
--------------------
So now I have to figure that out.

Ruby on Rails Tutorial Demo_App - rake db:migrate to Heroku not working

I'm doing Michael Hartl's Rails Tutorials and am having a bit of a problem with the final stage of the Demo App, that is, running the rake command on Heroku to migrate the database to the web.
The rake command with a --trace on it gives the following result:
$ heroku run rake db:migrate --trace
Running `rake db:migrate --trace` attached to terminal...
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36: command not found: tput cols
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36: command not found: tput lines
up, run.1
(in /app)
* Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
no such file to load -- pg
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `require'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `block in require'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:227:in `load_dependency'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `require'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:9:in `postgresql_connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `new_connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:238:in `checkout_new_connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:194:in `block (2 levels) in checkout'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in `loop'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in `block in checkout'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:189:in `checkout'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:96:in `connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:318:in `retrieve_connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:97:in `retrieve_connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/migration.rb:486:in `initialize'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/migration.rb:433:in `new'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/migration.rb:433:in `up'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/migration.rb:415:in `migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/railties/databases.rake:142:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `load'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
I thought that that 'command not found: tput' stuff at the start might have been down to something I modified (it looks like the word 'output' that got cut off) so I redid the entire chapter from the beginning, but ended up with the same result, so I don't think it's any changes I made to the code.
I'm using a Windows PC, running XP. Everything worked fine when run on the localhost and my Git Repository pushed to Heroku perfectly, so everything works except for this rake command. If ye want to see any of the other files, they're at: https://github.com/jimbobsweeney/demo_app
I'm very grateful in advance for any help on this. It's melting my brain.
Rob
Do you have Cygwin installed? This article (in Japanese) mentions this error and points to this SO question which suggests you make sure Cygwin and possibly ncurses is installed. A comment there links to this article which may also have useful information.
It looks like the issue is that heroku is looking for the tput command in your shell which is not available (which I believe comes with ncurses).
As for the stack trace, it looks like the pg gem is not in your Gemfile in a place the production environment will execute it. It's not necessary to install pg on Windows just to get the deploy working. Create a :production group in your Gemfile for this.
group :production do
gem "pg", "~> 0.11.0"
end
You can learn more about groups in the bundler docs.

rake gives an error about an uninitialized constant Consolidated

I am trying to build a rails app written by a friend of mine and when I run rake db:setup I get the following error - I am running on debian using rvm to run ruby 1.9.2 and rails 3.1.0 Can anyone point me in the right directon to solve this? Why is the migration trying to use a constant thats undefined? Do I need to define it somewhere? I am not a rails dev so this has me stumped.
$ 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
rake aborted!
An error has occurred, this and all later migrations canceled:
uninitialized constant Consolidated
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:124:in `block in constantize'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:123:in `each'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:123:in `constantize'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.1.0/lib/active_support/core_ext/string/inflections.rb:43:in `constantize'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/migration.rb:517:in `load_migration'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/migration.rb:512:in `migration'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/migration.rb:507:in `migrate'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/migration.rb:687:in `block (2 levels) in migrate'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/migration.rb:742:in `call'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/migration.rb:742:in `block in ddl_transaction'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/transactions.rb:208:in `transaction'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/migration.rb:742:in `ddl_transaction'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/migration.rb:686:in `block in migrate'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/migration.rb:671:in `each'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/migration.rb:671:in `migrate'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/migration.rb:549:in `up'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/migration.rb:530:in `migrate'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/activerecord-3.1.0/lib/active_record/railties/databases.rake:161:in `block (2 levels) in <top (required)>'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/andrew/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/bin/rake:19:in `load'
/home/andrew/.rvm/gems/ruby-1.9.2-p136/bin/rake:19:in `<main>'
Tasks: TOP => db:migrate

Neither PUB key nor PRIV key:: nested asn1 error with apn_on_rails

I am trying to configure apn_on_rails to send push notifications from rails3 to iOS devices.
When I run bundle exec rake apn:notifications:deliver --trace
I get the following error:
(in /home/mari/Documents/descuentos)
** Invoke apn:notifications:deliver (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute apn:notifications:deliver
rake aborted!
Neither PUB key nor PRIV key:: nested asn1 error
/home/mari/.rvm/gems/ruby-1.9.2-p290/bundler/gems/apn_on_rails-18f5d37397e3/lib/apn_on_rails/libs/connection.rb:52:in `initialize'
/home/mari/.rvm/gems/ruby-1.9.2-p290/bundler/gems/apn_on_rails-18f5d37397e3/lib/apn_on_rails/libs/connection.rb:52:in `new'
/home/mari/.rvm/gems/ruby-1.9.2-p290/bundler/gems/apn_on_rails-18f5d37397e3/lib/apn_on_rails/libs/connection.rb:52:in `open'
/home/mari/.rvm/gems/ruby-1.9.2-p290/bundler/gems/apn_on_rails-18f5d37397e3/lib/apn_on_rails/libs/connection.rb:23:in `open_for_delivery'
/home/mari/.rvm/gems/ruby-1.9.2-p290/bundler/gems/apn_on_rails-18f5d37397e3/lib/apn_on_rails/app/models/apn/notification.rb:104:in `send_notifications'
/home/mari/.rvm/gems/ruby-1.9.2-p290/bundler/gems/apn_on_rails-18f5d37397e3/lib/apn_on_rails/tasks/apn.rake:7:in `block (3 levels) in <top (required)>'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/mari/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/home/mari/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/home/mari/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/home/mari/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
Tasks: TOP => apn:notifications:deliver
I am running the application from ubuntu (can that cause the problem?). The person that is an agent in the apple developers program has generated the p12 and the pem twice for me from his computer following these instructions:
Click the disclosure arrow next to your certificate in Keychain Access and select the certificate and the key.
Right click and choose Export 2 items….
Choose the p12 format from the drop down and name it cert.p12.
but I keep getting the error.
What can I do to fix it?
The certificate that was given to me was wrong. After generating the right certificate and p12 the problem was solved.