jeromemacias/webistrano — Issue #2: Error 500 when assigning user to stage
Author: zedtux
Created: 2012-02-08 10:14:18+00:00
State: open

Given a normal user (not Admin)
With a privilege on a project
When an Admin user try to add privilege on stage level to this user
Then Admin user see the error 500.

## Backtrace

````bash
ActiveRecord::StatementInvalid (PGError: ERROR: relation "stages_users_id_seq" does not exist
: SELECT currval('stages_users_id_seq')):
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `rescue in log'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract_adapter.rb:204:in `log'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/postgresql_adapter.rb:520:in `execute'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1002:in `select_raw'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/postgresql_adapter.rb:989:in `select'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `block in select_all_with_query_cache'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/query_cache.rb:81:in `cache_sql'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all_with_query_cache'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:13:in `select_one'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:19:in `select_value'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/postgresql_adapter.rb:983:in `last_insert_id'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/postgresql_adapter.rb:478:in `insert'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/base.rb:2961:in `create'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/timestamp.rb:53:in `create_with_timestamps'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/callbacks.rb:266:in `create_with_callbacks'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/base.rb:2927:in `create_or_update'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/callbacks.rb:250:in `create_or_update_with_callbacks'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/base.rb:2577:in `save'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/validations.rb:1089:in `save_with_validation'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/dirty.rb:79:in `save_with_dirty'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in `block in with_transaction_returning_status'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/transactions.rb:182:in `transaction'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/transactions.rb:196:in `block in save_with_transactions'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/transactions.rb:196:in `save_with_transactions'
app/controllers/stage_users_controller.rb:11:in `create'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/base.rb:1333:in `perform_action'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:617:in `call_filters'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:638:in `block in run_before_filters'
app/controllers/application_controller.rb:23:in `set_timezone'
bundle/ruby/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `evaluate_method'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:186:in `call'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:635:in `run_before_filters'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:615:in `call_filters'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:610:in `perform_action_with_filters'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:68:in `block in perform_action_with_benchmark'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/rescue.rb:160:in `perform_action_with_rescue'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/flash.rb:151:in `perform_action_with_flash'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/base.rb:532:in `process'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/filters.rb:606:in `process_with_filters'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/base.rb:391:in `process'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/base.rb:386:in `call'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/routing/route_set.rb:438:in `call'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:87:in `dispatch'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:121:in `_call'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:130:in `block in build_middleware_stack'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/query_cache.rb:29:in `call'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/query_cache.rb:29:in `block in call'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/query_cache.rb:9:in `cache'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/query_cache.rb:28:in `call'
bundle/ruby/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/string_coercion.rb:25:in `call'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/params_parser.rb:15:in `call'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/session/cookie_store.rb:99:in `call'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/failsafe.rb:26:in `call'
:10:in `synchronize'
bundle/ruby/1.9.1/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:106:in `call'
bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:80:in `block in pre_process'
bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:78:in `catch'
bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:78:in `pre_process'
bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:53:in `process'
bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:38:in `receive_data'
bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/backends/base.rb:61:in `start'
bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/server.rb:159:in `start'
bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/controllers/controller.rb:86:in `start'
bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/runner.rb:185:in `run_command'
bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/runner.rb:151:in `run!'
bundle/ruby/1.9.1/gems/thin-1.3.1/bin/thin:6:in `'
bundle/ruby/1.9.1/bin/thin:19:in `load'
bundle/ruby/1.9.1/bin/thin:19:in `

'
````