undefined method 'cells' #22

Closed
arches opened this Issue Jul 3, 2012 · 1 comment

1 participant

@arches
Owner

One of the orders doesn't have any discount codes. Thought this had been taken care of but apparently not.

irb(main):036:0> tp User.chris.orders, :id, :number, {:price => {display_method: :total_price_in_cents}}, {:payment => {display_method: :payment_total_in_cents}}, :emailed, :status, {:quantity => {:display_method => "line_items.quantity"}}, {:youtech_id => {:display_method => "line_items.redeemables.youtech_id"}}, "discount_codes.discount_type"
  User Load (25.9ms)  SELECT "users".* FROM "users" WHERE "users"."email" = 'chris.doyle@aisle50.com' LIMIT 1
  Order Load (4.3ms)  SELECT "orders".* FROM "orders" WHERE "orders"."user_id" = 1057529309
  LineItem Load (1.9ms)  SELECT "line_items".* FROM "line_items" WHERE "line_items"."order_id" = 1069293442
  Redeemable Load (4.6ms)  SELECT "redeemables".* FROM "redeemables" WHERE "redeemables"."line_item_id" = 22223
  DiscountCode Load (6.6ms)  SELECT "discount_codes".* FROM "discount_codes" WHERE "discount_codes"."order_id" = 1069293442
  LineItem Load (1.7ms)  SELECT "line_items".* FROM "line_items" WHERE "line_items"."order_id" = 1069293441
  Redeemable Load (5.9ms)  SELECT "redeemables".* FROM "redeemables" WHERE "redeemables"."line_item_id" = 22222
  DiscountCode Load (5.5ms)  SELECT "discount_codes".* FROM "discount_codes" WHERE "discount_codes"."order_id" = 1069293441
  LineItem Load (4.7ms)  SELECT "line_items".* FROM "line_items" WHERE "line_items"."order_id" = 1069293440
  Redeemable Load (5.0ms)  SELECT "redeemables".* FROM "redeemables" WHERE "redeemables"."line_item_id" = 22221
  DiscountCode Load (4.4ms)  SELECT "discount_codes".* FROM "discount_codes" WHERE "discount_codes"."order_id" = 1069293440
NoMethodError: undefined method `cells' for nil:NilClass
    from /app/vendor/bundle/ruby/1.9.1/bundler/gems/table_print-078f10ada34a/lib/row_group.rb:154:in `block in collapse!'
    from /app/vendor/bundle/ruby/1.9.1/bundler/gems/table_print-078f10ada34a/lib/row_group.rb:152:in `each'
    from /app/vendor/bundle/ruby/1.9.1/bundler/gems/table_print-078f10ada34a/lib/row_group.rb:152:in `collapse!'
    from /app/vendor/bundle/ruby/1.9.1/bundler/gems/table_print-078f10ada34a/lib/row_group.rb:109:in `each'
    from /app/vendor/bundle/ruby/1.9.1/bundler/gems/table_print-078f10ada34a/lib/row_group.rb:109:in `collapse!'
    from /app/vendor/bundle/ruby/1.9.1/bundler/gems/table_print-078f10ada34a/lib/table_print.rb:36:in `table_print'
    from /app/vendor/bundle/ruby/1.9.1/bundler/gems/table_print-078f10ada34a/lib/kernel_extensions.rb:7:in `tp'
    from (irb):36
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/commands/console.rb:45:in `start'
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/commands/console.rb:8:in `start'
    from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/commands.rb:40:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
@arches
Owner

A simpler example: tp User.chris.orders, :id, :number, "discount_codes.discount_type", "line_items.quantity"

It works fine if you take out either of the nested fields.

@arches arches added a commit that closed this issue Aug 3, 2012
@arches Allow collapsing of empty groups
Fixes #22
8e677bc
@arches arches closed this in 8e677bc Aug 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment