Closed bossnass1986 closed 8 years ago
Can you give the full stack trace? There isn't an "orders_users" table so I'm a bit puzzled with the error.
Did you make any changes to the code?
I'll be glad to help but so far I can't think of why you have this error.
Started PATCH "/shopping/cart_items/1" for 127.0.0.1 at 2016-01-19 21:20:30 +1100 Processing by Shopping::CartItemsController#update as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"HLxbyQB6lesevryxdyAGmXcxok1Cht080zCip/rssgCP1Ieq+Vw8Ji66mxzHXT4/06tomSE4L21Ibf+ffmJ2Dw==", "cart"=>{"shopping_cart_items_attributes"=>{"0"=>{"quantity"=>"1", "id"=>"2"}}}, "commit"=>"ORDER NOW", "id"=>"1"} User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]] Cart Load (0.3ms) SELECT "carts".* FROM "carts" WHERE "carts"."id" = $1 LIMIT 1 [["id", 1]] CartItem Load (0.3ms) SELECT "cart_items".* FROM "cart_items" WHERE "cart_items"."active" = $1 AND "cart_items"."item_type_id" = $2 AND "cart_items"."cart_id" IN (1) ["active", "t"], ["item_type_id", 1] BEGIN (0.1ms) COMMIT Redirected to http://localhost:3000/shopping/orders/checkout/checkout Completed 302 Found in 8ms (ActiveRecord: 1.0ms)
Started GET "/shopping/orders/checkout/checkout" for 127.0.0.1 at 2016-01-19 21:20:30 +1100 Processing by Shopping::OrdersController#checkout as HTML Parameters: {"id"=>"checkout"} User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]] PG::UndefinedTable: ERROR: relation "orders_users" does not exist LINE 5: WHERE a.attrelid = '"orders_users"'::regclass ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"orders_users"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum
Completed 500 Internal Server Error in 40ms (ActiveRecord: 7.2ms)
PG::UndefinedTable - ERROR: relation "orders_users" does not exist
LINE 5: WHERE a.attrelid = '"orders_users"'::regclass
^
:
activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:596:in block in exec_no_cache' activerecord (4.2.4) lib/active_record/connection_adapters/abstract_adapter.rb:473:in
block in log'
activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in instrument' activerecord (4.2.4) lib/active_record/connection_adapters/abstract_adapter.rb:467:in
log'
activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:596:in exec_no_cache' activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:588:in
execute_and_clear'
activerecord (4.2.4) lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in exec_query' activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:737:in
column_definitions'
activerecord (4.2.4) lib/active_record/connection_adapters/postgresql/schema_statements.rb:186:in columns' activerecord (4.2.4) lib/active_record/connection_adapters/schema_cache.rb:43:in
columns'
activerecord (4.2.4) lib/active_record/connection_adapters/schema_cache.rb:49:in columns_hash' activerecord (4.2.4) lib/active_record/associations/association_scope.rb:85:in
column_for'
activerecord (4.2.4) lib/active_record/associations/association_scope.rb:94:in bind' activerecord (4.2.4) lib/active_record/associations/association_scope.rb:103:in
last_chain_scope'
activerecord (4.2.4) lib/active_record/associations/association_scope.rb:139:in add_constraints' activerecord (4.2.4) lib/active_record/associations/association_scope.rb:39:in
scope'
activerecord (4.2.4) lib/active_record/associations/association_scope.rb:5:in scope' activerecord (4.2.4) lib/active_record/associations/association.rb:97:in
association_scope'
activerecord (4.2.4) lib/active_record/associations/association.rb:86:in scope' activerecord (4.2.4) lib/active_record/associations/collection_association.rb:423:in
scope'
activerecord (4.2.4) lib/active_record/associations/collection_proxy.rb:37:in initialize' activerecord (4.2.4) lib/active_record/relation/delegation.rb:106:in
create'
activerecord (4.2.4) lib/active_record/associations/collection_association.rb:41:in reader' activerecord (4.2.4) lib/active_record/associations/builder/association.rb:115:in
orders'
app/controllers/shopping/base_controller.rb:62:in create_order' app/controllers/shopping/base_controller.rb:56:in
find_or_create_order'
app/controllers/shopping/orders_controller.rb:25:in checkout' actionpack (4.2.4) lib/action_controller/metal/implicit_render.rb:4:in
send_action'
actionpack (4.2.4) lib/abstract_controller/base.rb:198:in process_action' actionpack (4.2.4) lib/action_controller/metal/rendering.rb:10:in
process_action'
actionpack (4.2.4) lib/abstract_controller/callbacks.rb:20:in block in process_action' activesupport (4.2.4) lib/active_support/callbacks.rb:117:in
call'
activesupport (4.2.4) lib/active_support/callbacks.rb:555:in block (2 levels) in compile' activesupport (4.2.4) lib/active_support/callbacks.rb:505:in
call'
activesupport (4.2.4) lib/active_support/callbacks.rb:92:in __run_callbacks__' activesupport (4.2.4) lib/active_support/callbacks.rb:778:in
_run_process_action_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:in run_callbacks' actionpack (4.2.4) lib/abstract_controller/callbacks.rb:19:in
process_action'
actionpack (4.2.4) lib/action_controller/metal/rescue.rb:29:in process_action' actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:32:in
block in process_action'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in block in instrument' activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in
instrument'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in instrument' actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:30:in
process_action'
actionpack (4.2.4) lib/action_controller/metal/params_wrapper.rb:250:in process_action' activerecord (4.2.4) lib/active_record/railties/controller_runtime.rb:18:in
process_action'
actionpack (4.2.4) lib/abstract_controller/base.rb:137:in process' actionview (4.2.4) lib/action_view/rendering.rb:30:in
process'
actionpack (4.2.4) lib/action_controller/metal.rb:196:in dispatch' actionpack (4.2.4) lib/action_controller/metal/rack_delegation.rb:13:in
dispatch'
actionpack (4.2.4) lib/action_controller/metal.rb:237:in block in action' actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:76:in
dispatch'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:45:in serve' actionpack (4.2.4) lib/action_dispatch/journey/router.rb:43:in
block in serve'
actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:in serve' actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:821:in
call'
warden (1.2.4) lib/warden/manager.rb:35:in block in call' warden (1.2.4) lib/warden/manager.rb:34:in
call'
rack (1.6.4) lib/rack/etag.rb:24:in call' rack (1.6.4) lib/rack/conditionalget.rb:25:in
call'
rack (1.6.4) lib/rack/head.rb:13:in call' actionpack (4.2.4) lib/action_dispatch/middleware/params_parser.rb:27:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/flash.rb:260:in call' rack (1.6.4) lib/rack/session/abstract/id.rb:225:in
context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in call' actionpack (4.2.4) lib/action_dispatch/middleware/cookies.rb:560:in
call'
activerecord (4.2.4) lib/active_record/query_cache.rb:36:in call' activerecord (4.2.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in
call'
activerecord (4.2.4) lib/active_record/migration.rb:377:in call' actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:29:in
block in call'
activesupport (4.2.4) lib/active_support/callbacks.rb:88:in __run_callbacks__' activesupport (4.2.4) lib/active_support/callbacks.rb:778:in
_run_call_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:27:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/reloader.rb:73:incall' actionpack (4.2.4) lib/action_dispatch/middleware/remote_ip.rb:78:in
call'
better_errors (2.1.1) lib/better_errors/middleware.rb:84:inprotected_app_call' better_errors (2.1.1) lib/better_errors/middleware.rb:79:in
better_errors_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:incall' actionpack (4.2.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/show_exceptions.rb:30:incall' railties (4.2.4) lib/rails/rack/logger.rb:38:in
call_app'
railties (4.2.4) lib/rails/rack/logger.rb:20:inblock in call' activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in
block in tagged'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:26:intagged' activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in
tagged'
railties (4.2.4) lib/rails/rack/logger.rb:20:incall' actionpack (4.2.4) lib/action_dispatch/middleware/request_id.rb:21:in
call'
rack (1.6.4) lib/rack/methodoverride.rb:22:incall' rack (1.6.4) lib/rack/runtime.rb:18:in
call'
activesupport (4.2.4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:incall' rack (1.6.4) lib/rack/lock.rb:17:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/static.rb:116:incall' rack (1.6.4) lib/rack/sendfile.rb:113:in
call'
railties (4.2.4) lib/rails/engine.rb:518:incall' railties (4.2.4) lib/rails/application.rb:165:in
call'
rack (1.6.4) lib/rack/content_length.rb:15:incall' puma (2.15.3) lib/puma/server.rb:541:in
handle_request'
puma (2.15.3) lib/puma/server.rb:388:inprocess_client' puma (2.15.3) lib/puma/server.rb:270:in
block in run'
puma (2.15.3) lib/puma/thread_pool.rb:106:in`block in spawn_thread'
Started POST "/__better_errors/462674e9d9015abf/variables" for 127.0.0.1 at 2016-01-19 21:20:30 +1100
Started GET "/shopping/orders/checkout/checkout" for 127.0.0.1 at 2016-01-19 22:37:17 +1100 Processing by Shopping::OrdersController#checkout as HTML Parameters: {"id"=>"checkout"} User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]] PG::UndefinedTable: ERROR: relation "orders_users" does not exist LINE 5: WHERE a.attrelid = '"orders_users"'::regclass ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"orders_users"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum
Completed 500 Internal Server Error in 51ms (ActiveRecord: 8.2ms)
PG::UndefinedTable - ERROR: relation "orders_users" does not exist
LINE 5: WHERE a.attrelid = '"orders_users"'::regclass
^
:
activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:596:in block in exec_no_cache' activerecord (4.2.4) lib/active_record/connection_adapters/abstract_adapter.rb:473:in
block in log'
activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in instrument' activerecord (4.2.4) lib/active_record/connection_adapters/abstract_adapter.rb:467:in
log'
activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:596:in exec_no_cache' activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:588:in
execute_and_clear'
activerecord (4.2.4) lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in exec_query' activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:737:in
column_definitions'
activerecord (4.2.4) lib/active_record/connection_adapters/postgresql/schema_statements.rb:186:in columns' activerecord (4.2.4) lib/active_record/connection_adapters/schema_cache.rb:43:in
columns'
activerecord (4.2.4) lib/active_record/connection_adapters/schema_cache.rb:49:in columns_hash' activerecord (4.2.4) lib/active_record/associations/association_scope.rb:85:in
column_for'
activerecord (4.2.4) lib/active_record/associations/association_scope.rb:94:in bind' activerecord (4.2.4) lib/active_record/associations/association_scope.rb:103:in
last_chain_scope'
activerecord (4.2.4) lib/active_record/associations/association_scope.rb:139:in add_constraints' activerecord (4.2.4) lib/active_record/associations/association_scope.rb:39:in
scope'
activerecord (4.2.4) lib/active_record/associations/association_scope.rb:5:in scope' activerecord (4.2.4) lib/active_record/associations/association.rb:97:in
association_scope'
activerecord (4.2.4) lib/active_record/associations/association.rb:86:in scope' activerecord (4.2.4) lib/active_record/associations/collection_association.rb:423:in
scope'
activerecord (4.2.4) lib/active_record/associations/collection_proxy.rb:37:in initialize' activerecord (4.2.4) lib/active_record/relation/delegation.rb:106:in
create'
activerecord (4.2.4) lib/active_record/associations/collection_association.rb:41:in reader' activerecord (4.2.4) lib/active_record/associations/builder/association.rb:115:in
orders'
app/controllers/shopping/base_controller.rb:62:in create_order' app/controllers/shopping/base_controller.rb:56:in
find_or_create_order'
app/controllers/shopping/orders_controller.rb:25:in checkout' actionpack (4.2.4) lib/action_controller/metal/implicit_render.rb:4:in
send_action'
actionpack (4.2.4) lib/abstract_controller/base.rb:198:in process_action' actionpack (4.2.4) lib/action_controller/metal/rendering.rb:10:in
process_action'
actionpack (4.2.4) lib/abstract_controller/callbacks.rb:20:in block in process_action' activesupport (4.2.4) lib/active_support/callbacks.rb:117:in
call'
activesupport (4.2.4) lib/active_support/callbacks.rb:555:in block (2 levels) in compile' activesupport (4.2.4) lib/active_support/callbacks.rb:505:in
call'
activesupport (4.2.4) lib/active_support/callbacks.rb:92:in __run_callbacks__' activesupport (4.2.4) lib/active_support/callbacks.rb:778:in
_run_process_action_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:in run_callbacks' actionpack (4.2.4) lib/abstract_controller/callbacks.rb:19:in
process_action'
actionpack (4.2.4) lib/action_controller/metal/rescue.rb:29:in process_action' actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:32:in
block in process_action'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in block in instrument' activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in
instrument'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in instrument' actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:30:in
process_action'
actionpack (4.2.4) lib/action_controller/metal/params_wrapper.rb:250:in process_action' activerecord (4.2.4) lib/active_record/railties/controller_runtime.rb:18:in
process_action'
actionpack (4.2.4) lib/abstract_controller/base.rb:137:in process' actionview (4.2.4) lib/action_view/rendering.rb:30:in
process'
actionpack (4.2.4) lib/action_controller/metal.rb:196:in dispatch' actionpack (4.2.4) lib/action_controller/metal/rack_delegation.rb:13:in
dispatch'
actionpack (4.2.4) lib/action_controller/metal.rb:237:in block in action' actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:76:in
dispatch'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:45:in serve' actionpack (4.2.4) lib/action_dispatch/journey/router.rb:43:in
block in serve'
actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:in serve' actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:821:in
call'
warden (1.2.4) lib/warden/manager.rb:35:in block in call' warden (1.2.4) lib/warden/manager.rb:34:in
call'
rack (1.6.4) lib/rack/etag.rb:24:in call' rack (1.6.4) lib/rack/conditionalget.rb:25:in
call'
rack (1.6.4) lib/rack/head.rb:13:in call' actionpack (4.2.4) lib/action_dispatch/middleware/params_parser.rb:27:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/flash.rb:260:in call' rack (1.6.4) lib/rack/session/abstract/id.rb:225:in
context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in call' actionpack (4.2.4) lib/action_dispatch/middleware/cookies.rb:560:in
call'
activerecord (4.2.4) lib/active_record/query_cache.rb:36:in call' activerecord (4.2.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in
call'
activerecord (4.2.4) lib/active_record/migration.rb:377:in call' actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:29:in
block in call'
activesupport (4.2.4) lib/active_support/callbacks.rb:88:in __run_callbacks__' activesupport (4.2.4) lib/active_support/callbacks.rb:778:in
_run_call_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:27:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/reloader.rb:73:incall' actionpack (4.2.4) lib/action_dispatch/middleware/remote_ip.rb:78:in
call'
better_errors (2.1.1) lib/better_errors/middleware.rb:84:inprotected_app_call' better_errors (2.1.1) lib/better_errors/middleware.rb:79:in
better_errors_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:incall' actionpack (4.2.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/show_exceptions.rb:30:incall' railties (4.2.4) lib/rails/rack/logger.rb:38:in
call_app'
railties (4.2.4) lib/rails/rack/logger.rb:20:inblock in call' activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in
block in tagged'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:26:intagged' activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in
tagged'
railties (4.2.4) lib/rails/rack/logger.rb:20:incall' actionpack (4.2.4) lib/action_dispatch/middleware/request_id.rb:21:in
call'
rack (1.6.4) lib/rack/methodoverride.rb:22:incall' rack (1.6.4) lib/rack/runtime.rb:18:in
call'
activesupport (4.2.4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:incall' rack (1.6.4) lib/rack/lock.rb:17:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/static.rb:116:incall' rack (1.6.4) lib/rack/sendfile.rb:113:in
call'
railties (4.2.4) lib/rails/engine.rb:518:incall' railties (4.2.4) lib/rails/application.rb:165:in
call'
rack (1.6.4) lib/rack/content_length.rb:15:incall' puma (2.15.3) lib/puma/server.rb:541:in
handle_request'
puma (2.15.3) lib/puma/server.rb:388:inprocess_client' puma (2.15.3) lib/puma/server.rb:270:in
block in run'
puma (2.15.3) lib/puma/thread_pool.rb:106:in`block in spawn_thread'
Started POST "/__better_errors/75cc59e159dc0b82/variables" for 127.0.0.1 at 2016-01-19 22:37:18 +1100
Started GET "/shopping/orders/checkout/checkout" for 127.0.0.1 at 2016-01-19 22:41:27 +1100 Processing by Shopping::OrdersController#checkout as HTML Parameters: {"id"=>"checkout"} User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]] Completed 500 Internal Server Error in 27ms (ActiveRecord: 4.1ms)
NameError - undefined local variable or method orders' for #<Shopping::OrdersController:0x007fdfdc9b9010>: app/controllers/shopping/base_controller.rb:62:in
create_order'
app/controllers/shopping/base_controller.rb:56:in find_or_create_order' app/controllers/shopping/orders_controller.rb:25:in
checkout'
actionpack (4.2.4) lib/action_controller/metal/implicit_render.rb:4:in send_action' actionpack (4.2.4) lib/abstract_controller/base.rb:198:in
process_action'
actionpack (4.2.4) lib/action_controller/metal/rendering.rb:10:in process_action' actionpack (4.2.4) lib/abstract_controller/callbacks.rb:20:in
block in process_action'
activesupport (4.2.4) lib/active_support/callbacks.rb:117:in call' activesupport (4.2.4) lib/active_support/callbacks.rb:555:in
block (2 levels) in compile'
activesupport (4.2.4) lib/active_support/callbacks.rb:505:in call' activesupport (4.2.4) lib/active_support/callbacks.rb:92:in
run_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:778:in _run_process_action_callbacks' activesupport (4.2.4) lib/active_support/callbacks.rb:81:in
run_callbacks'
actionpack (4.2.4) lib/abstract_controller/callbacks.rb:19:in process_action' actionpack (4.2.4) lib/action_controller/metal/rescue.rb:29:in
process_action'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:32:in block in process_action' activesupport (4.2.4) lib/active_support/notifications.rb:164:in
block in instrument'
activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in instrument' activesupport (4.2.4) lib/active_support/notifications.rb:164:in
instrument'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:30:in process_action' actionpack (4.2.4) lib/action_controller/metal/params_wrapper.rb:250:in
process_action'
activerecord (4.2.4) lib/active_record/railties/controller_runtime.rb:18:in process_action' actionpack (4.2.4) lib/abstract_controller/base.rb:137:in
process'
actionview (4.2.4) lib/action_view/rendering.rb:30:in process' actionpack (4.2.4) lib/action_controller/metal.rb:196:in
dispatch'
actionpack (4.2.4) lib/action_controller/metal/rack_delegation.rb:13:in dispatch' actionpack (4.2.4) lib/action_controller/metal.rb:237:in
block in action'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:76:in dispatch' actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:45:in
serve'
actionpack (4.2.4) lib/action_dispatch/journey/router.rb:43:in block in serve' actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:in
serve'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:821:in call' warden (1.2.4) lib/warden/manager.rb:35:in
block in call'
warden (1.2.4) lib/warden/manager.rb:34:in call' rack (1.6.4) lib/rack/etag.rb:24:in
call'
rack (1.6.4) lib/rack/conditionalget.rb:25:in call' rack (1.6.4) lib/rack/head.rb:13:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/params_parser.rb:27:in call' actionpack (4.2.4) lib/action_dispatch/middleware/flash.rb:260:in
call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in context' rack (1.6.4) lib/rack/session/abstract/id.rb:220:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/cookies.rb:560:in call' activerecord (4.2.4) lib/active_record/query_cache.rb:36:in
call'
activerecord (4.2.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in call' activerecord (4.2.4) lib/active_record/migration.rb:377:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:29:in block in call' activesupport (4.2.4) lib/active_support/callbacks.rb:88:in
run_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:778:in _run_call_callbacks' activesupport (4.2.4) lib/active_support/callbacks.rb:81:in
run_callbacks'
actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:27:in call' actionpack (4.2.4) lib/action_dispatch/middleware/reloader.rb:73:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/remote_ip.rb:78:in call' better_errors (2.1.1) lib/better_errors/middleware.rb:84:in
protected_app_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:79:in better_errors_call' better_errors (2.1.1) lib/better_errors/middleware.rb:57:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in call' actionpack (4.2.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in
call'
railties (4.2.4) lib/rails/rack/logger.rb:38:in call_app' railties (4.2.4) lib/rails/rack/logger.rb:20:in
block in call'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in block in tagged' activesupport (4.2.4) lib/active_support/tagged_logging.rb:26:in
tagged'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in tagged' railties (4.2.4) lib/rails/rack/logger.rb:20:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/request_id.rb:21:in call' rack (1.6.4) lib/rack/methodoverride.rb:22:in
call'
rack (1.6.4) lib/rack/runtime.rb:18:in call' activesupport (4.2.4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in
call'
rack (1.6.4) lib/rack/lock.rb:17:in call' actionpack (4.2.4) lib/action_dispatch/middleware/static.rb:116:in
call'
rack (1.6.4) lib/rack/sendfile.rb:113:in call' railties (4.2.4) lib/rails/engine.rb:518:in
call'
railties (4.2.4) lib/rails/application.rb:165:in call' rack (1.6.4) lib/rack/content_length.rb:15:in
call'
puma (2.15.3) lib/puma/server.rb:541:in handle_request' puma (2.15.3) lib/puma/server.rb:388:in
process_client'
puma (2.15.3) lib/puma/server.rb:270:in block in run' puma (2.15.3) lib/puma/thread_pool.rb:106:in
block in spawn_thread'
Started POST "/__better_errors/2197c85dd0d99941/variables" for 127.0.0.1 at 2016-01-19 22:41:28 +1100
Started GET "/shopping/orders/checkout/checkout" for 127.0.0.1 at 2016-01-19 22:47:18 +1100 Processing by Shopping::OrdersController#checkout as HTML Parameters: {"id"=>"checkout"} User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]] PG::UndefinedTable: ERROR: relation "orders_users" does not exist LINE 5: WHERE a.attrelid = '"orders_users"'::regclass ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"orders_users"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum
Completed 500 Internal Server Error in 63ms (ActiveRecord: 8.4ms)
PG::UndefinedTable - ERROR: relation "orders_users" does not exist
LINE 5: WHERE a.attrelid = '"orders_users"'::regclass
^
:
activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:596:in block in exec_no_cache' activerecord (4.2.4) lib/active_record/connection_adapters/abstract_adapter.rb:473:in
block in log'
activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in instrument' activerecord (4.2.4) lib/active_record/connection_adapters/abstract_adapter.rb:467:in
log'
activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:596:in exec_no_cache' activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:588:in
execute_and_clear'
activerecord (4.2.4) lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in exec_query' activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:737:in
column_definitions'
activerecord (4.2.4) lib/active_record/connection_adapters/postgresql/schema_statements.rb:186:in columns' activerecord (4.2.4) lib/active_record/connection_adapters/schema_cache.rb:43:in
columns'
activerecord (4.2.4) lib/active_record/connection_adapters/schema_cache.rb:49:in columns_hash' activerecord (4.2.4) lib/active_record/associations/association_scope.rb:85:in
column_for'
activerecord (4.2.4) lib/active_record/associations/association_scope.rb:94:in bind' activerecord (4.2.4) lib/active_record/associations/association_scope.rb:103:in
last_chain_scope'
activerecord (4.2.4) lib/active_record/associations/association_scope.rb:139:in add_constraints' activerecord (4.2.4) lib/active_record/associations/association_scope.rb:39:in
scope'
activerecord (4.2.4) lib/active_record/associations/association_scope.rb:5:in scope' activerecord (4.2.4) lib/active_record/associations/association.rb:97:in
association_scope'
activerecord (4.2.4) lib/active_record/associations/association.rb:86:in scope' activerecord (4.2.4) lib/active_record/associations/collection_association.rb:423:in
scope'
activerecord (4.2.4) lib/active_record/associations/collection_proxy.rb:37:in initialize' activerecord (4.2.4) lib/active_record/relation/delegation.rb:106:in
create'
activerecord (4.2.4) lib/active_record/associations/collection_association.rb:41:in reader' activerecord (4.2.4) lib/active_record/associations/builder/association.rb:115:in
orders'
app/controllers/shopping/base_controller.rb:62:in create_order' app/controllers/shopping/base_controller.rb:56:in
find_or_create_order'
app/controllers/shopping/orders_controller.rb:25:in checkout' actionpack (4.2.4) lib/action_controller/metal/implicit_render.rb:4:in
send_action'
actionpack (4.2.4) lib/abstract_controller/base.rb:198:in process_action' actionpack (4.2.4) lib/action_controller/metal/rendering.rb:10:in
process_action'
actionpack (4.2.4) lib/abstract_controller/callbacks.rb:20:in block in process_action' activesupport (4.2.4) lib/active_support/callbacks.rb:117:in
call'
activesupport (4.2.4) lib/active_support/callbacks.rb:555:in block (2 levels) in compile' activesupport (4.2.4) lib/active_support/callbacks.rb:505:in
call'
activesupport (4.2.4) lib/active_support/callbacks.rb:92:in __run_callbacks__' activesupport (4.2.4) lib/active_support/callbacks.rb:778:in
_run_process_action_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:in run_callbacks' actionpack (4.2.4) lib/abstract_controller/callbacks.rb:19:in
process_action'
actionpack (4.2.4) lib/action_controller/metal/rescue.rb:29:in process_action' actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:32:in
block in process_action'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in block in instrument' activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in
instrument'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in instrument' actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:30:in
process_action'
actionpack (4.2.4) lib/action_controller/metal/params_wrapper.rb:250:in process_action' activerecord (4.2.4) lib/active_record/railties/controller_runtime.rb:18:in
process_action'
actionpack (4.2.4) lib/abstract_controller/base.rb:137:in process' actionview (4.2.4) lib/action_view/rendering.rb:30:in
process'
actionpack (4.2.4) lib/action_controller/metal.rb:196:in dispatch' actionpack (4.2.4) lib/action_controller/metal/rack_delegation.rb:13:in
dispatch'
actionpack (4.2.4) lib/action_controller/metal.rb:237:in block in action' actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:76:in
dispatch'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:45:in serve' actionpack (4.2.4) lib/action_dispatch/journey/router.rb:43:in
block in serve'
actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:in serve' actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:821:in
call'
warden (1.2.4) lib/warden/manager.rb:35:in block in call' warden (1.2.4) lib/warden/manager.rb:34:in
call'
rack (1.6.4) lib/rack/etag.rb:24:in call' rack (1.6.4) lib/rack/conditionalget.rb:25:in
call'
rack (1.6.4) lib/rack/head.rb:13:in call' actionpack (4.2.4) lib/action_dispatch/middleware/params_parser.rb:27:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/flash.rb:260:in call' rack (1.6.4) lib/rack/session/abstract/id.rb:225:in
context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in call' actionpack (4.2.4) lib/action_dispatch/middleware/cookies.rb:560:in
call'
activerecord (4.2.4) lib/active_record/query_cache.rb:36:in call' activerecord (4.2.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in
call'
activerecord (4.2.4) lib/active_record/migration.rb:377:in call' actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:29:in
block in call'
activesupport (4.2.4) lib/active_support/callbacks.rb:88:in __run_callbacks__' activesupport (4.2.4) lib/active_support/callbacks.rb:778:in
_run_call_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:27:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/reloader.rb:73:incall' actionpack (4.2.4) lib/action_dispatch/middleware/remote_ip.rb:78:in
call'
better_errors (2.1.1) lib/better_errors/middleware.rb:84:inprotected_app_call' better_errors (2.1.1) lib/better_errors/middleware.rb:79:in
better_errors_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:incall' actionpack (4.2.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/show_exceptions.rb:30:incall' railties (4.2.4) lib/rails/rack/logger.rb:38:in
call_app'
railties (4.2.4) lib/rails/rack/logger.rb:20:inblock in call' activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in
block in tagged'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:26:intagged' activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in
tagged'
railties (4.2.4) lib/rails/rack/logger.rb:20:incall' actionpack (4.2.4) lib/action_dispatch/middleware/request_id.rb:21:in
call'
rack (1.6.4) lib/rack/methodoverride.rb:22:incall' rack (1.6.4) lib/rack/runtime.rb:18:in
call'
activesupport (4.2.4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:incall' rack (1.6.4) lib/rack/lock.rb:17:in
call'
actionpack (4.2.4) lib/action_dispatch/middleware/static.rb:116:incall' rack (1.6.4) lib/rack/sendfile.rb:113:in
call'
railties (4.2.4) lib/rails/engine.rb:518:incall' railties (4.2.4) lib/rails/application.rb:165:in
call'
rack (1.6.4) lib/rack/content_length.rb:15:incall' puma (2.15.3) lib/puma/server.rb:541:in
handle_request'
puma (2.15.3) lib/puma/server.rb:388:inprocess_client' puma (2.15.3) lib/puma/server.rb:270:in
block in run'
puma (2.15.3) lib/puma/thread_pool.rb:106:in`block in spawn_thread'
This is very odd.
class User
has_many :orders
end
There isn't a join table. Did you change the users model at all? Can you give me access to your code for a day? Even just the controllers & models would be enough.
If not then the users model & orders model would help most.
How much of the original code has changed? Do the tests still pass?
for some reason we had has_and_belongs_to_many, appears to be working now
when attempting to checkout an order i get the following message
ERROR: relation "orders_users" does not exist LINE 5: WHERE a.attrelid = '"orders_users"'::regclass
def create_order @session_order = current_user.orders.create(:number => Time.now.to_i, :ip_address => request.env['REMOTE_ADDR'], :bill_address => current_user.billing_address ) add_new_cart_items(session_cart.shopping_cart_items) session[:order_id] = @session_order.id end