prawn undefined method headers - ruby-on-rails-3

I'm trying to output my cucumber tests to pdf format. I've been doing this for a while and it's worked. After upgrading some gems my pdf output has stopped working with the error:
% rake cucumber:new_report_pdf
(in /home/map7/pais)
NOTICE: CREATE TABLE will create implicit sequence "employees_id_seq" for serial column "employees.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "employees_pkey" for table "employees"
NOTICE: CREATE TABLE will create implicit sequence "entities_id_seq" for serial column "entities.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "entities_pkey" for table "entities"
NOTICE: CREATE TABLE will create implicit sequence "ledgers_id_seq" for serial column "ledgers.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "ledgers_pkey" for table "ledgers"
NOTICE: CREATE TABLE will create implicit sequence "staff_id_seq" for serial column "staff.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "staff_pkey" for table "staff"
bundle exec /home/map7/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -I "/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib:lib" "/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/bin/cucumber" --profile new_report_pdf
Using the new_report_pdf profile...
..........undefined method `headers=' for #<Prawn::Table:0x0000000697d4d8> (NoMethodError)
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/prawn-0.11.1/lib/prawn/table.rb:124:in `block in initialize'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/prawn-0.11.1/lib/prawn/table.rb:124:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/prawn-0.11.1/lib/prawn/table.rb:124:in `initialize'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/prawn-0.11.1/lib/prawn/table.rb:25:in `new'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/prawn-0.11.1/lib/prawn/table.rb:25:in `table'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:240:in `print_table'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:161:in `block in before_multiline_arg'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:219:in `call'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:219:in `block in render'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:218:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:218:in `render'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:229:in `flush'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/formatter/pdf.rb:105:in `after_feature_element'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:174:in `block in send_to_all'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:172:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:172:in `send_to_all'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:165:in `broadcast'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:50:in `visit_feature_element'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/feature.rb:40:in `block in accept'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/feature.rb:39:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/feature.rb:39:in `accept'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:20:in `block in visit_feature'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:19:in `visit_feature'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/features.rb:29:in `block in accept'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/features.rb:17:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/features.rb:17:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/features.rb:28:in `accept'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:14:in `block in visit_features'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:13:in `visit_features'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/runtime.rb:45:in `run!'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/cli/main.rb:43:in `execute!'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/lib/cucumber/cli/main.rb:20:in `execute'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.2/bin/cucumber:14:in `<main>'
rake aborted!
Command failed with status (1): [bundle exec /home/map7/.rvm/rubies/ruby-1....]
(See full trace by running task with --trace)
Here is my cucumber.yml file
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~#wip"
%>
default: <%= std_opts %> features
wip: --tags #wip:3 --wip features
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~#wip
report: --format html --out=features.html
report_pdf: --format pdf --out=features.pdf
new: --tags #new
new_report: --format html --out=features_new.html --tags #new
new_report_pdf: --format pdf --out=features_new.pdf --tags #new
Do I have to upgrade cucumber? or downgrade prawn or something?
Update: I've tried using the latest cucumber & prawn git repo (24/05/2011) in my Gemfile and running bundle. I still get the same problem.
Update: (18/07/2011)
After following take_tk's advice and using
$ gem uninstall prawn --version=0.11.1
I got a little further but still have an issue:
..rake aborted!
Command failed with status (1): [/home/map7/.rvm/rubies/ruby-1.9.2-p180/bin...]
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:45:in `call'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:45:in `sh'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `sh'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-1.0.0/lib/cucumber/rake/task.rb:104:in `run'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-1.0.0/lib/cucumber/rake/task.rb:193:in `block in define_task'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/map7/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/home/map7/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/home/map7/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/home/map7/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
Tasks: TOP => cucumber:new_report_pdf

I have the same trouble. So, uninstalled "prawn --version=0.11.1". Then I got OK.
[tk#EeePC-31 kyuuyo]$ sudo gem list prawn*
* LOCAL GEMS *
prawn (0.11.1, 0.8.4) <<<-- version confused!
prawn-core (0.8.4)
prawn-layout (0.8.4)
prawn-security (0.8.4)
[tk#EeePC-31 kyuuyo]$ sudo gem uninstall prawn --version=0.11.1
Successfully uninstalled prawn-0.11.1
[tk#EeePC-31 kyuuyo]$ sudo gem list prawn*
* LOCAL GEMS *
prawn (0.8.4)
prawn-core (0.8.4)
prawn-layout (0.8.4)
prawn-security (0.8.4)

Related

invalid byte sequence in US-ASCII during assets:precompile

I can no longer deploy my app because of an UTF error, here is the trace :
/srv/outils/www/railsapp/releases/20140414151455$ cd -- /srv/outils/www/railsapp/releases/20140414151455 && RAILS_ENV=prodtest RAILS_GROUPS=assets bundle exec rake assets:precompile --trace
rake aborted!
rake aborted!
invalid byte sequence in US-ASCII
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/trace_output.rb:16:in `block in trace_on'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/trace_output.rb:14:in `map'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/trace_output.rb:14:in `trace_on'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:340:in `trace'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:187:in `display_error_message'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:174:in `rescue in standard_exception_handling'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/bin/rake:23:in `load'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/bin/rake:23:in `<main>'
The LANG variable is set to fr_FR.UTF-8.
What bother me is that which ruby gives me :
/home/admin/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
I installed a rvm gem and now i have exactly the same error with the correct RVM path.
I tried :
Adding #encoding UTF-8 everywhere
Added :
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
Checked $LANG on my server
Removed any éè etc.. from my previous commits
EDIT : Migrated from ruby 1.9.3 to 2.1
Where to go now to investigate this problem?

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.

devise generating views error

I've got a problem with devise gem, when I enter rails generate devise:install command there is an error:
/home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/inflector/methods.rb:124:in `block in constantize': unin
itialized constant View (NameError)
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/inflector/methods.rb:123:in `each'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/inflector/methods.rb:123:in `constantize'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/core_ext/string/inflections.rb:43:in `const
antize'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.1.rc1/lib/devise/mapping.rb:87:in `to'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.1.rc1/lib/devise/mapping.rb:80:in `modules'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.1.rc1/lib/devise/mapping.rb:93:in `strategies'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.1.rc1/lib/devise.rb:166:in `register'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.1.rc1/lib/devise/rails/routes.rb:92:in `block in devise_for'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.1.rc1/lib/devise/rails/routes.rb:91:in `each'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.1.rc1/lib/devise/rails/routes.rb:91:in `devise_for'
from /home/ofca/Praca/inzynierka/config/routes.rb:2:in `block in <top (required)>'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/route_set.rb:258:in `instance_exec'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/route_set.rb:258:in `eval_block'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/lib/action_dispatch/routing/route_set.rb:235:in `draw'
from /home/ofca/Praca/inzynierka/config/routes.rb:1:in `<top (required)>'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `block in load_paths
'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `each'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `load_paths'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:13:in `reload!'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:7:in `block in initialize'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `call'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `execute_if_up
dated'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/finisher.rb:63:in `block (2 levels) in <modul
e:Finisher>'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/finisher.rb:64:in `call'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/finisher.rb:64:in `block in <module:Finisher>
'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `each'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `run_initializers'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application.rb:96:in `initialize!'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/ofca/Praca/inzynierka/config/environment.rb:5:in `<top (required)>'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application.rb:83:in `require'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application.rb:83:in `require_environment!'
from /home/ofca/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:22:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I'm using Rails 3.1.1 and Ruby 1.9.2p290 (2011-07-09 revision 32553) on Linux. And db is postgres.
Here is the line mentioned in the first line of the error log:
constant = constant.const_defined?(name, false) ? constant.const_get(name) : constant.const_missing(name)
Oh, and I tried other combinations of this command: rails generate devise:install, rails g devise_install and it gives me the same effect
You are using a very old version of Devise that is not even meant to be used in production (it is a release candidate!). Please update your Devise version.
solution: add to gemfile:
gem 'devise', :git => 'git://github.com/plataformatec/devise.git'

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.

Issues implementing Rspec with Rails3 from tutorial

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.