sdsykes / slim_scrooge

SlimScrooge heavily optimises your database interactions
313 stars 25 forks source link

Getting Server-Error "User can't be referred" #4

Closed swoker closed 14 years ago

swoker commented 14 years ago

Hi

I have the issue that I'm getting the 500 Internal Server Error "User can't be referred". This only happens when I add the gem to my environment.rb.

Also I can run another application which uses Rails 2.2.2 with your gem without any problems. I've switched my app to 2.2.2, but I still get the same error. I don't think it's the appliaction's fault, because it runs fine on my production server.

I've added the server output to this ticket.

Kind regards Simon

pa-dus-104:smsweb swoker$ script/server => Booting Mongrel => Rails 2.3.5 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server SQL (0.2ms) SET SQL_AUTO_IS_NULL=0

Processing MessagesController#new (for 127.0.0.1 at 2009-12-23 15:38:06) [GET] Parameters: {"action"=>"new", "controller"=>"messages"} User Columns (2.5ms) SHOW FIELDS FROM users User Load (0.6ms) SELECT * FROM users WHERE (users.id = -1) Redirected to http://localhost:3000/login Filter chain halted as [:authorize] rendered_or_redirected. Completed in 79ms (DB: 17) | 302 Found [http://localhost/] ^CExiting

adding following line to environment.rb config.gem 'slim_scrooge'

pa-dus-104:smsweb swoker$ rake db:sessions:clear (in /Users/swoker/project/smsweb) pa-dus-104:smsweb swoker$ script/server => Booting Mongrel => Rails 2.3.5 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server SQL (0.3ms) SET SQL_AUTO_IS_NULL=0

Processing MessagesController#new (for 127.0.0.1 at 2009-12-23 15:38:29) [GET] Parameters: {"action"=>"new", "controller"=>"messages"} User Columns (2.5ms) SHOW FIELDS FROM users User Load SlimScrooged 1st time (0.7ms) SELECT * FROM users WHERE (users.id = -1) Redirected to http://localhost:3000/login Filter chain halted as [:authorize] rendered_or_redirected. Completed in 71ms (DB: 10) | 302 Found [http://localhost/] SQL (0.2ms) SET SQL_AUTO_IS_NULL=0

Processing UsersController#login (for 127.0.0.1 at 2009-12-23 15:38:29) [GET] Parameters: {"action"=>"login", "controller"=>"users"} User Columns (2.9ms) SHOW FIELDS FROM users User Load SlimScrooged 1st time (0.6ms) SELECT * FROM users WHERE (users.remember_token = '8a784121d97f68d16f0ff1ec40f648b48afff5e0') LIMIT 1 Redirected to http://localhost:3000/ Completed in 27ms (DB: 4) | 302 Found [http://localhost/login] SQL (0.2ms) SET SQL_AUTO_IS_NULL=0

Processing MessagesController#new (for 127.0.0.1 at 2009-12-23 15:38:29) [GET] Parameters: {"action"=>"new", "controller"=>"messages"} User Columns (2.6ms) SHOW FIELDS FROM users User Load SlimScrooged (0.5ms) SELECT users.id FROM users WHERE (users.id = 1) MessageToUser Columns (2.4ms) SHOW FIELDS FROM message_to_users SQL (4.5ms) SELECT count(*) AS count_all FROM message_to_users WHERE (user_id = 1 and created_at > '2009-12-01 00:00:00' and created_at < '2010-01-01 00:00:00') User Reload SlimScrooged (0.8ms) SELECT users.salt,users.max_sms_per_month,users.updated_at,users.hashed_password,users.nickname,users.contact_id,users.admin,users.id,users.remember_token,users.created_at FROM users WHERE id IN ('1') Message Columns (2.6ms) SHOW FIELDS FROM sms Rendering template within layouts/default Rendering messages/new Completed in 220ms (View: 45, DB: 15) | 200 OK [http://localhost/] /!\ FAILSAFE /!\ Wed Dec 23 15:38:29 +0100 2009 Status: 500 Internal Server Error User can't be referred /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/session_store.rb:67:in dump' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/session_store.rb:67:inmarshal' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/session_store.rb:123:in marshal_data!' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:insend' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in evaluate_method' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:incall' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:93:in run' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:ineach' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:in send' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:92:inrun' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in run_callbacks' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:344:incallback' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/callbacks.rb:249:in create_or_update' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:2538:insave_without_validation' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/validations.rb:1078:in save_without_dirty' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/dirty.rb:79:insave_without_transactions' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:229:in send' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:229:inwith_transaction_returning_status' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in transaction' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:182:intransaction' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:228:in with_transaction_returning_status' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:196:insave' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:208:in rollback_active_record_state!' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/transactions.rb:196:insave' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/session_store.rb:300:in set_session' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:1448:insilence' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/session_store.rb:297:in set_session' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/session/abstract_store.rb:132:incall' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in call' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/query_cache.rb:34:incache' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9:in cache' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28:incall' /Library/Ruby/Gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in call' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:incall' /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in call' /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:insynchronize' /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in call' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:114:incall' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:34:in run' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:incall' /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails/rack/static.rb:31:in call' /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:46:incall' /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in each' /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:incall' /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails/rack/log_tailer.rb:17:in call' /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/content_length.rb:13:incall' /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/chunked.rb:15:in call' /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:64:inprocess' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:ineach' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:inrun' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:innew' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:ininitialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:inrun' /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:34:in run' /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:111 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:ingem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' script/server:3

sdsykes commented 14 years ago

I think this is due to the way classes are reloaded in development mode.

This doesn't happen in production mode, right?

sdsykes commented 14 years ago

This is fixed in version 1.0.4

swoker commented 14 years ago

Works fine now. Thanks a lot!