spree/spree — Issue #839: "First order" promotion rule breaks user signup
Author: radar
Created: 2011-12-05 05:43:26+00:00
State: open

To reproduce, follow the promotion setup instructions in #836 OP, and then sign in as a new user. I see this error:

undefined method `user' for nil:NilClass

With this backtrace:

activesupport (3.1.3) lib/active_support/whiny_nil.rb:48:in `method_missing'
/Users/ryan/Sites/gems/spree/promo/app/models/spree/promotion/rules/first_order.rb:4:in `eligible?'
/Users/ryan/Sites/gems/spree/promo/app/models/spree/promotion.rb:65:in `block in rules_are_eligible?'
activerecord (3.1.3) lib/active_record/associations/collection_proxy.rb:91:in `each'
activerecord (3.1.3) lib/active_record/associations/collection_proxy.rb:91:in `all?'
activerecord (3.1.3) lib/active_record/associations/collection_proxy.rb:91:in `method_missing'
/Users/ryan/Sites/gems/spree/promo/app/models/spree/promotion.rb:65:in `rules_are_eligible?'
/Users/ryan/Sites/gems/spree/promo/app/models/spree/promotion.rb:59:in `eligible?'
/Users/ryan/Sites/gems/spree/promo/app/models/spree/promotion.rb:51:in `activate'
/Users/ryan/Sites/gems/spree/core/lib/spree/core/engine.rb:25:in `block (3 levels) in '
activerecord (3.1.3) lib/active_record/relation.rb:15:in `each'
activerecord (3.1.3) lib/active_record/relation.rb:15:in `each'
/Users/ryan/Sites/gems/spree/core/lib/spree/core/engine.rb:24:in `block (2 levels) in '