Can't migrate database from 0.13

Support Ticket

+status
+tags
 

I had to upgrade my wagn at thornton2.com from version 0.13 before I was ready. I used the Git download instructions at about 10:00 PM MST on Wednesday, January 5. The application is running, but the database has not been migrated.

 

Before performing the upgrade, I dumped a backup of my MySQL production database, so I can restore it relatively easily if the database contents are mangled beyond repair.

 

However, running rake RAILS_ENV='production' db:migrate aborts during AddInStarAccountContent with "undefined method `created_by' for nil:NilClass".

 

Have I done something wrong?

rake RAILS_ENV='production' --trace db:migrate
(in /home/arielmt/thornton2.com)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Invoke setup (first_time)
** Execute setup
** Execute environment
** Execute db:migrate
==  AddInStarAccountContent: migrating ========================================
rake aborted!
An error has occurred, all later migrations canceled:

undefined method `created_by' for nil:NilClass
./db/migrate//20090531015048_add_in_star_account_content.rb:6:in `up_without_benchmarks'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:282:in `send'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:282:in `migrate'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:282:in `migrate'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:365:in `__send__'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:365:in `migrate'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:491:in `migrate'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:567:in `call'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:567:in `ddl_transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:490:in `migrate'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:477:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:477:in `migrate'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:401:in `up'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:383:in `migrate'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/tasks/databases.rake:112
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/arielmt/.gems/gems/rake-0.8.7/bin/rake:31
/home/arielmt/.gems/bin/rake:19:in `load'
/home/arielmt/.gems/bin/rake:19

 

Hi Ariel,

 

No, I don't think you've done anything wrong, but apparent Wagn has.  There've been a lot of significant changes between 0.13 and 1.5, so at some point some code that an old migration depended on may have gotten changed several releases after we'd last used the migrations.

 

What I'd do is restore your database, pull an intermediate Wagn release (like, say 1.2) and migrate there (and dump with a new name), and then re-migrate to 1.5.  If you still get errors, then I'd repeat but adding another major release pull.

 

If you're feeling saucy, you could try a more one-off approach.  I took a look at the specific old migration that broke (from May, 2009), and it looks to me like it's expecting there to be a card named "*account".  Unlike later migrations, it doesn't have good handling for what happens if it isn't there.  I don't know why your wagn wouldn't have that card, but you could try creating the card.  Saucier still would be to change the migration db/migrate//20090531015048_add_in_star_account_content.rb from "Card['*account']" to "Card.fetch_or_create('*account')".  The latter will only work in Wagn 1.5.

 

Problem with the one-off is that the next migration might have a new problem, so it's back to the drawing board.

 

- Ethan

 

 

 

 


I'm wondering if my database is just plain borked. (I was afflicted with the mysterious "can't create card because it already exists even though it doesn't" bug about a year back.)

 

I downloaded and unpacked each major release (1.x) after 0.13, modified each to connect to my database, and ran rake RAILS_ENV='production' --trace db:migrate one release at a time. Now the live one succeeds, but I'm still getting "error rendering [card name]" messages on every card.

 

log/production.log:

Processing CardController#show (for 208.38.215.21 at 2011-01-07 17:12:27) [GET]

Parameters: {"id"=>"Welcome"}

Rendering template within layouts/application

Completed in 1200ms (View: 1173, DB: 22) | 200 OK [http://thornton2.com/wagn/Welcome]

 

I'll try copying my production database into my testing or development bases to see if I can't produce more informative log messages.

  --Ariel Millennium Thornton.....Fri Jan 07 20:03:50 -0800 2011


I copied into development, and the only thing I'm getting in log/development.log is:

----------- Wagn Initialization Complete -----------

 

DEPRECATION WARNING: Giving :session_key to SessionStore is deprecated, please use :key instead. (called from new at /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/middleware_stack.rb:72)

 

 

Processing CardController#index (for 65.113.122.74 at 2011-01-09 17:04:33) [GET]

Rendering template within layouts/application

Completed in 542ms (View: 351, DB: 34) | 200 OK [http://thornton2.com/]

 

And the rendering is identical except for bits of CSS and the favicon.

  --Ariel Millennium Thornton.....Sun Jan 09 17:09:10 -0800 2011


I wonder if something is funky with your cache. The old "can't create card because it already exists even though it doesn't" snag your were hitting before sounds like something where it exists in the cache but not the db. I would run `rake cache:clear`. And, in fact, if you're doing file caching, I would probably even take a step further and delete the /tmp/cache directory so you know it's starting over.

 

My guess is that you're not getting a good error here because the problem is getting rescued at the inclusion level. (going on the "error rendering [card]" thing you're seeing. I'm realizing those exceptions should be logged. I'll try to get a patch for that out soon. In the meantime, you might (or might not) be able to get a more helpful message by adding "?layout=none"

  --Ethan McCutchen.....Sun Jan 09 21:00:33 -0800 2011


I was stopped by my host taking away access to /sbin/ifconfig (actually, they set /proc/net to be unreadable by hosted users), which broke the gem macaddr which the gem uuid depends on. I had to implement a hack to get it working again:

* taking the output of ifconfig on one of my systems to a file,

* prepending 'echo "' and appending '"' to each line, including blank lines,

* inserting '#!/bin/sh' at the top of the file,

* setting the file world-executable, and

* copying it into ~/.gems/bin on my host since that's in my PATH and GEM_PATH there.

 

I then had to start over with my database and go one version at a time, but rake RAILS_ENV='production' --trace db:migrate while in wagn-1.4.0 dumped the following during an otherwise progressive migration:

 

== SetCardtypePlusDescription: migrating =====================================

== SetCardtypePlusDescription: migrated (0.4498s) ============================

 

== KillPatternSpecKey: migrating =============================================

-- remove_column(:cards, :pattern_spec_key)

-> 0.1618s

== KillPatternSpecKey: migrated (0.1619s) ====================================

 

== SetStarSendPlusStarRightPlusStarDefault: migrating ========================

rake aborted!

An error has occurred, all later migrations canceled:

 

Mysql::Error: Unknown column 'pattern_spec_key' in 'field list': INSERT INTO `cards` (`name`, `reader_type`, `created_at`, `tag_id`, `indexed_content`, `updated_at`, `indexed_name`, `pattern_spec_key`, `trash`, `codename`, `current_revision_id`, `created_by`, `reader_id`, `references_expired`, `pattern_keys`, `trunk_id`, `type`, `extension_type`, `updated_by`, `settings`, `extension_id`, `key`, `appender_type`, `appender_id`) VALUES('*send+*right+*default', 'Role', '2011-01-11 07:37:05', 700, NULL, '2011-01-11 07:37:05', NULL, NULL, 0, NULL, NULL, 1, 2, NULL, NULL, 742, 'Pointer', NULL, 1, NULL, NULL, '*send+*right+*default', NULL, NULL)

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `insert_sql'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:333:in `insert_sql'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in `insert_without_query_dirty'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:18:in `insert'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/base.rb:2908:in `create_without_timestamps'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/timestamp.rb:53:in `create_without_callbacks'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/callbacks.rb:266:in `create_without_user'

/home/arielmt/junk/wagn-1.4.0/vendor/plugins/userstamp/lib/userstamp.rb:36:in `create'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/base.rb:2874:in `create_or_update_without_callbacks'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/callbacks.rb:250:in `create_or_update'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/base.rb:2538:in `save_without_validation'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/validations.rb:1078:in `save_without_dirty'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/dirty.rb:79:in `save_without_transactions'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/transactions.rb:229:in `send'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/transactions.rb:196:in `save_without_permissions'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/transactions.rb:196:in `save_without_permissions'

/home/arielmt/junk/wagn-1.4.0/lib/cardlib/permissions.rb:54:in `save'

/home/arielmt/junk/wagn-1.4.0/app/models/card/base.rb:263:in `find_or_create'

/home/arielmt/junk/wagn-1.4.0/app/models/card.rb:25:in `send'

/home/arielmt/junk/wagn-1.4.0/app/models/card.rb:25:in `method_missing'

./db/migrate//20100422235300_set_star_send_plus_star_right_plus_star_default.rb:4:in `up_without_benchmarks'

/home/arielmt/junk/wagn-1.4.0/app/models/user.rb:47:in `as'

./db/migrate//20100422235300_set_star_send_plus_star_right_plus_star_default.rb:3:in `up_without_benchmarks'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `send'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `migrate'

/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `migrate'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:365:in `__send__'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:365:in `migrate'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:486:in `migrate'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:562:in `call'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:562:in `ddl_transaction'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:485:in `migrate'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:472:in `each'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:472:in `migrate'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:400:in `up'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/activerecord/lib/active_record/migration.rb:383:in `migrate'

/home/arielmt/junk/wagn-1.4.0/vendor/rails/railties/lib/tasks/databases.rake:116

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:636:in `call'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:636:in `execute'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:631:in `each'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:631:in `execute'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'

/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2029:in `each'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2001:in `run'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'

/home/arielmt/.gems/gems/rake-0.8.7/lib/rake.rb:1998:in `run'

/home/arielmt/.gems/gems/rake-0.8.7/bin/rake:31

/home/arielmt/.gems/bin/rake:19:in `load'

/home/arielmt/.gems/bin/rake:19

  --Ariel Millennium Thornton.....Tue Jan 11 07:46:21 -0800 2011


Running rake db:migrate from the live Wagn, fetched from git last Wednesday, ran every pending migration successfully.

  --Ariel Millennium Thornton.....Tue Jan 11 07:54:49 -0800 2011


awesome. so you're not getting those rendering errors any more?

  --Ethan McCutchen.....Tue Jan 11 09:07:18 -0800 2011


The layout isn't what I expected at all, but at least the cards are showing.

 

Right now, I can't edit any cards. No editor is showing up on the card edit page.

 

I'm able to add cards, if I'm to believe http://thornton2.com/wagn/The_site_obviously_needs_fixing, but I can't edit any. I need to fix up card types and permissions, as they've expanded far more drastically than I could've hoped.

 

In addition to not being able to edit cards, I'm 500'ing on the card link Related/Plusses. When I get time, I'll switch to development mode and get a full error listing.

  --Ariel Millennium Thornton.....Tue Jan 11 17:25:14 -0800 2011


Yeah, it looks to me like your css (and presumably your js) are way out of date. Try this:

 

rake RAILS_ENV=production asset:packager:build_all

 

this rebuilds the js and css. I'm assuming that you're running in production mode?

  --Ethan McCutchen.....Tue Jan 11 18:26:38 -0800 2011


Are we saving a list of recipes like this? (Our FAQ seems rather more user-oriented) Lots of info in one line:

 

to rebuild javascript and css: rake RAILS_ENV=production asset:packager:build_all

  --John Abbe.....Tue Jan 11 19:25:55 -0800 2011


I guess the question is how to make it easier to find in the flow of things. Seems like a trouble shooting page, under "my layout looks wonky" and "cards won't edit". something like that.

 

I mean, this code is on the installation page, but you'd have to know what you were looking for.

  --Ethan McCutchen.....Tue Jan 11 20:46:33 -0800 2011


I'll have to make sure my JS and CSS copied properly from the unboxing to the live. (I thought it did.) Anyway, I ran asset:packager:build_all after getting cards to display, and it had no effect on layout.

 

I'll move my customizations out of live, copy from what git downloads to live, copy my customizations back (making sure they don't look like they'll cause bad juju), and re-run asset:packager:build_all. I'm not off my rocker with this plan, am I? After seeing what the 500 error on related/pluses writes to the log, I mean.

  --Ariel Millennium Thornton.....Tue Jan 11 21:30:01 -0800 2011


OK, I looked deeper and I can see that, while the css and js are wrong, the asset packaging is not the problem.

 

This asset packager thing is basically an optimization to get all of the css and js on one page each. When I look at that one css sheet: http://thornton2.com/stylesheets/base_packaged.css, I can see that it's NOT the right css (it should look more like this http://www.wagn.org/stylesheets/base_packaged.css).

 

But I can also look at the component css pages and see that they're not right: http://thornton2.com/stylesheets/page.css should look more like http://www.wagn.org/stylesheets/page.css, which is, of course, the same as the current version from github: https://github.com/wagn/wagn/blob/master/public/stylesheets/page.css. The "build_all" thing is building the packaged css out of these parts. If the parts are wrong, the whole will be too.

 

maybe you have git ignoring the "public" directory? or maybe you managed to checkout current code only in the apps directory or something? or maybe your server is somehow using an old cached copy of the css?

 

In any case, if you can figure out how to get it using the current css and js, things should look considerably less oogly.

  --Ethan McCutchen.....Wed Jan 12 08:23:16 -0800 2011


Well, things are looking a lot better now and the application isn't 500'ing on Related/Pluses anymore, but the editor still isn't showing on any card or type. I read the TinyMCE broken in current Git version support card embedded in the download card, and that's exactly what I'm seeing. Unlike kewagi, I'm running on Rails 2.3.8, not 3.0.

  --Ariel Millennium Thornton.....Sun Jan 16 17:54:50 -0800 2011


More info: I'm seeing the card source HTML even when going to edit a form card. That is, instead of seeing a form with HTML blobs where edit fields should be when editing a card formatted by a form card, I'm seeing just one single blob of HTML and JavaScript.

  --Ariel Millennium Thornton.....Sun Jan 16 18:01:44 -0800 2011


Try rails 2.3.5. the unwanted HTML escaping issue is a rails bug that was introduced between 2.3.5 and 2.3.8.

  --Ethan McCutchen.....Mon Jan 17 09:29:28 -0800 2011


Works, insofar as I'm able to edit cards again. However, Passenger is frequently failing to start and the error page renders in some interesting spots.

 

I don't know if it's related, but the cardtype I made in Wagn 0.13, Journal Entry, has permissions problems I don't understand. The form includes three actual and one virtual pluses, and I can't get one of the actuals, +discussion, to render for anonymous users. I get a black on pink "error rendering Testing+discussion" (for the Journal Entry card Testing) on the View tab and a 500 "hitch in the wagn" error expanding the +discussion card on the Related/Pluses tab. Just prior to this problem, I tried fixing the permissions so that anyone could view new Journal Entry cards; only "Anyone signed in" has been able to view them since the upgrade.

 

Anyone signed in can view, edit, and comment on these cards normally.

  --Ariel Millennium Thornton.....Mon Jan 17 16:10:14 -0800 2011


This will be in master soon, but if you add this to the end of "def process inclusions" in app/helpers/slot.rb", you should get more useful info on those rendering errors:

 

  result

rescue Exception=>e

  warn e.inspect

  Rails.logger.info e.inspect

  Rails.logger.debug e.backtrace.join " "

  %{error rendering #{link_to_page tcard.name}}

end

  --Ethan McCutchen.....Mon Jan 17 20:54:29 -0800 2011


I switched to development mode, made these changes, reloaded my home page. I can't run /sbin/ifconfig without getting an error, but I still have my fake ifconfig command in both $PATH and $GEM_PATH.

 

The line "%{error rendering #{link_to_page tcard.name}}" gave the error "NoMethodError in Card#index Showing app/views/layouts/application.html.erb where line #32 raised: undefined method `tcard' for # ".

 

I changed tcard.name to card.name (which is what the original error rendering line read) and got the following:

 

==> log/development.log <==

 

----------- Wagn Initialization Complete -----------

 

 

 

Processing CardController#index (for 208.38.215.21 at 2011-01-25 17:17:29) [GET]

Rendering template within layouts/application

#

#

#

#

#

#

#

#

#

#

#

Completed in 976ms (View: 883, DB: 51) | 200 OK [http://thornton2.com/]

  --Ariel Millennium Thornton.....Tue Jan 25 17:30:36 -0800 2011


Ah, nice, the error messages were stripped because they looked like SGML tags. :(

 

Each line stripped above read: RuntimeError: all of /sbin/ifconfig /bin/ifconfig ifconfig ipconfig /all failed

  --Ariel Millennium Thornton.....Tue Jan 25 18:25:25 -0800 2011


I switched back to production mode, but I did not undo the edit to app/helpers/slot.rb.

 

I got the fake ifconfig to run by manually setting ENV['PATH'] in config/environment.rb. Now the cards are rendering again, and I'm back to where I was before. Some cards are rendering for "Anyone logged in" but not for "Anyone" even though the permissions say they should.

 

http://thornton2.com/wagn/Testing+discussion

 

If I'm logged in, the card is displayed fine. If I'm not, then "error rendering Testing+discussion" is sent to the browser and the following is dumped to log/production:

 

Processing CardController#show (for 208.38.215.21 at 2011-01-25 19:12:36) [GET]

Parameters: {"id"=>"Testing+discussion"}

Rendering template within layouts/application

#<ActionView::TemplateError:

ActionView::TemplateError (No public key specified.) on line #14 of app/views/views/_open.rhtml:

11: <%= f.text_area :comment, :rows=>3 %><br/>

12: <% unless User.current_user.login != "anon" %>

13: <% card.comment_author= (session[:comment_author] || params[:comment_author] || "Anonymous") %> <%#ENGLISH%>

14: <%= slot.half_captcha %>

15: <label>My Name is:</label>

16: <%= f.text_field :comment_author, {'onClick'=>"this.value=''" } %>

17: <% end %>

 

app/helpers/slot.rb:544:in `send'

app/helpers/slot.rb:544:in `method_missing'

app/helpers/slot.rb:544:in `method_missing'

app/helpers/slot.rb:814:in `half_captcha'

app/views/views/_open.rhtml:14:in `_run_rhtml_app47views47views47_open46rhtml_locals_card_object_open_slot'

app/helpers/wagn_helper.rb:279:in `wagn_form_for'

app/views/views/_open.rhtml:10:in `_run_rhtml_app47views47views47_open46rhtml_locals_card_object_open_slot'

app/helpers/slot.rb:489:in `render_partial'

app/helpers/slot.rb:226:in `render'

app/helpers/slot.rb:529:in `process_inclusion'

app/helpers/slot.rb:426:in `expand_inclusion'

app/helpers/slot.rb:392:in `expand_inclusions'

app/helpers/slot.rb:391:in `gsub'

app/helpers/slot.rb:391:in `expand_inclusions'

app/helpers/slot.rb:323:in `render_expanded_view_content'

app/helpers/slot.rb:268:in `render'

app/helpers/wagn_helper.rb:296:in `render_layout_card'

app/views/layouts/application.html.erb:32

app/controllers/card_controller.rb:64:in `render_show'

app/controllers/card_controller.rb:56:in `show'

/home/arielmt/.gems/gems/hoptoad_notifier-2.4.2/lib/hoptoad_notifier/rack.rb:27:in `call'

/dh/passenger/lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'

/dh/passenger/lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'

/dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:400:in `start_request_handler'

/dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:351:in `handle_spawn_application'

/dh/passenger/lib/phusion_passenger/utils.rb:184:in `safe_fork'

/dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:349:in `handle_spawn_application'

/dh/passenger/lib/phusion_passenger/abstract_server.rb:352:in `__send__'

/dh/passenger/lib/phusion_passenger/abstract_server.rb:352:in `main_loop'

/dh/passenger/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

/dh/passenger/lib/phusion_passenger/abstract_server.rb:163:in `start'

/dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:209:in `start'

/dh/passenger/lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'

/dh/passenger/lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'

/dh/passenger/lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'

/dh/passenger/lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'

/dh/passenger/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'

/dh/passenger/lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'

/dh/passenger/lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'

/dh/passenger/lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'

/dh/passenger/lib/phusion_passenger/abstract_server.rb:352:in `__send__'

/dh/passenger/lib/phusion_passenger/abstract_server.rb:352:in `main_loop'

/dh/passenger/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

 

>

Completed in 185ms (View: 162, DB: 19) | 200 OK [http://thornton2.com/wagn/Testing+discussion]

  --Ariel Millennium Thornton.....Tue Jan 25 19:23:30 -0800 2011


whoa, the error's about the captcha key? Do you have captcha's turned on? Check out docs here: captcha

  --Ethan McCutchen.....Tue Jan 25 20:02:31 -0800 2011


If so, then it's on by default. I've never set up captchas.

  --Ariel Millennium Thornton.....Tue Jan 25 20:11:01 -0800 2011


Getting and installing recaptcha keys fixed the problem, but I didn't see a way to globally turn captchas on or off, only a per-card or per-type setting.

  --Ariel Millennium Thornton.....Tue Jan 25 20:19:48 -0800 2011


If you're in version 1.5.x, then you should have Setting cards. Setting cards, like *captcha, can be attached to any Set of cards, including single cards, cards of a certain type, or all cards. The easiest way to access these settings is through the options tab, which has a settings subtab. (Soon permissions, too, will be handled by settings, so the "options" tab will go away, and it will just be a "Settings" tab.)

 

From any card, go to options -> settings and then open up the *captcha setting to see how things are configured.

 

In any event, the error you were seeing looks to me like it has to do with having the captcha key correctly configured. if that's set up, then you shouldn't see the issue regardless of the configuration.

 

In the bigger picture, though, it's obviously our fault if wagn fails in this situation rather than giving you a decent error message. sorry about that.

 

-ethan

  --Ethan McCutchen.....Wed Jan 26 10:16:50 -0800 2011