undefined method `scoped' for Model:Class with Formtastic and MongoMapper - ruby-on-rails-3

I'm having a hard time making MongoMapper & Formtastic work together.
In an effort to isolate the problem, I've created a dummy application with the bare minimum of code.
I have 2 main models (Cabinet & Device), with "many/belongs_to" relationship between them and a scaffolded controller for the Cabinet ressource.
When I load a very basic formtastic form (see below) with anything other than a simple "key" field declaration, I get a "NoMethodError" exception in the controller, with the following error "undefined method `scoped' for Device:Class" refering to the line #4 of the _form.html.haml partial.
Any idea on this one? Didn't find anything useful through Google or StackOverflow...
app/models/cabinet.rb
class Cabinet
include MongoMapper::Document
safe
key :label, String, :required => true
many :devices
end
app/models/device.rb
class Device
include MongoMapper::Document
safe
key :label, String, :required => true
belongs_to :cabinet
end
app/views/cabinet/_form.html.haml
= semantic_form_for #cabinet do |f|
= f.inputs do
= f.input :label
= f.input :devices
= f.actions
I did't include the scaffolded Controller, as I didn't touched the scaffolded code in any way.
Gem versions used :
Gems included by the bundle:
* actionmailer (3.2.7)
* actionpack (3.2.7)
* activemodel (3.2.7)
* activerecord (3.2.7)
* activeresource (3.2.7)
* activesupport (3.2.7)
* arel (3.0.2)
* bson (1.6.4)
* bson_ext (1.6.4)
* builder (3.0.0)
* bundler (1.1.5)
* coffee-rails (3.2.2)
* coffee-script (2.2.0)
* coffee-script-source (1.3.3)
* erubis (2.7.0)
* execjs (1.4.0)
* formtastic (2.2.1)
* haml (3.1.6)
* haml-rails (0.3.4)
* hike (1.2.1)
* hpricot (0.8.6)
* i18n (0.6.0)
* journey (1.0.4)
* jquery-rails (2.0.2)
* json (1.7.4)
* libv8 (3.3.10.4)
* mail (2.4.4)
* mime-types (1.19)
* mongo (1.6.4)
* mongo_mapper (0.11.2)
* multi_json (1.3.6)
* plucky (0.5.1)
* polyglot (0.3.3)
* rack (1.4.1)
* rack-cache (1.2)
* rack-ssl (1.3.2)
* rack-test (0.6.1)
* rails (3.2.7)
* railties (3.2.7)
* rake (0.9.2.2)
* rdoc (3.12)
* ruby_parser (2.3.1)
* sass (3.1.20)
* sass-rails (3.2.5)
* sexp_processor (3.2.0)
* sprockets (2.1.3)
* therubyracer (0.10.1)
* thor (0.15.4)
* tilt (1.3.3)
* treetop (1.4.10)
* tzinfo (0.3.33)
* uglifier (1.2.7)

mongomapper doesn't have the "scoped" class method. It's a feature of ActiveRecord and Mongoid.

Related

"A refresh_token is not available (RuntimeError)" when authenticating with Facebook or Google+

Using omniauth-oauth2 alongside omniauth-facebook and omniauth-google-oauth2 for social authentication with Devise, we saw this obscure error cropping up in our Cucumber suite. We couldn't figure out what was going wrong. Google led us on some goose hunts. Any ideas?
#selenium
Scenario: I can login with Google+ # features/authentication.feature:114
A refresh_token is not available (RuntimeError)
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/oauth2-0.8.1/lib/oauth2/access_token.rb:81:in `refresh!'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/omniauth-oauth2-1.0.3/lib/omniauth/strategies/oauth2.rb:63:in `callback_phase'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/omniauth-1.1.1/lib/omniauth/strategy.rb:219:in `callback_call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/omniauth-1.1.1/lib/omniauth/strategy.rb:175:in `call!'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/omniauth-1.1.1/lib/omniauth/strategy.rb:157:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/omniauth-1.1.1/lib/omniauth/strategy.rb:177:in `call!'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/omniauth-1.1.1/lib/omniauth/strategy.rb:157:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/meta_request-0.2.1/lib/meta_request/middlewares/app_request_handler.rb:11:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-contrib-1.1.0/lib/rack/contrib/response_headers.rb:17:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/meta_request-0.2.1/lib/meta_request/middlewares/headers.rb:16:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/meta_request-0.2.1/lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/request_store-1.0.5/lib/request_store/middleware.rb:9:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/sass-3.2.1/lib/sass/plugin/rack.rb:54:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/warden-1.2.1/lib/warden/manager.rb:35:in `block in call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/warden-1.2.1/lib/warden/manager.rb:34:in `catch'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/warden-1.2.1/lib/warden/manager.rb:34:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__3252172032061673430__call__1496937490684777386__callbacks'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/bugsnag-1.2.12/lib/bugsnag/rack.rb:36:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/cucumber-rails-1.4.0/lib/cucumber/rails/action_controller.rb:10:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-1.4.5/lib/rack/builder.rb:134:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-1.4.5/lib/rack/urlmap.rb:64:in `block in call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `each'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/capybara-2.0.3/lib/capybara/server.rb:19:in `call'
/Users/dev/.rvm/gems/ruby-1.9.3-p194#geostellar/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
/Users/dev/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/dev/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/dev/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
Given I am a visitor # features/step_definitions/authentication_steps.rb:6
When I visit the login or register page # features/step_definitions/authentication_steps.rb:52
And I login with Google+ # features/step_definitions/authentication_steps.rb:29
Then I see the text "Signed in successfully." # features/step_definitions/web_steps.rb:159
We discovered that the error only occurred when a previous test ran that used Timecop to travel forward in time by 1 day. As it turns out, Google tokens only last for 3600 seconds, so travelling an hour ahead invalidated the original token. Refreshing was then made impossible.
Moral of the story: don't forget to Timecop.return after travelling in time.

Passbook IOS6 sends HTTP DELETE to Rails 3.0.3 server, No route matches

I get "No route matches" when Passbook, on iOS6, sends my server an HTTP DELETE route.
In config/routes.rb, the route looks like:
delete "/v1/devices/:device_id/registrations/:pass_type_id/:serial_number" => "registrations#destroy"
and when I run "rake routes" I can see the route is there:
DELETE /v1/devices/:device_id/registrations/:pass_type_id/:serial_number(.:format) {:controller=>"registrations", :action=>"destroy"}
but when the route comes in to the Rails 3.0.3 development server as
Started DELETE "/v1/devices/515a5c955dcdd66f558e1b4041392bf3/registrations/pass.com.myserver.FreeDrink/11" for 192.168.0.22 at 2012-12-23 15:03:25 -0500
the rails server says:
ActionController::RoutingError (No route matches "/v1/devices/515a5c955dcdd66f558e1b4041392bf3/registrations/pass.com.myserver.FreeDrink/11"):
actionpack (3.0.3) lib/action_dispatch/middleware/show_exceptions.rb:53:in `call'
railties (3.0.3) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.4) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.4) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.4) lib/rack/lock.rb:11:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.3) lib/rails/application.rb:168:in `call'
railties (3.0.3) lib/rails/application.rb:77:in `method_missing'
railties (3.0.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.4) lib/rack/content_length.rb:13:in `call'
rack (1.2.4) lib/rack/handler/webrick.rb:52:in `service'
/home/user/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/home/user/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/home/user/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
All the other routes, using HTTP GET and POST work fine. This is the only route I'm having trouble with. I know that some browsers don't send HTTP DELETE, only HTTP GET and HTTP POST, and rails puts something in the header to indicate that the request is a delete, but it is Passbook that is sending the HTTP DELETE request, so I don't know if that has anything to do with the problem.
I've also tried other flavors of the route in config/routes.rb such as:
match "/v1/devices/:device_id/registrations/:pass_type_id/:serial_number" => "registrations#destroy", :via => :delete
and I've also tried using other controllers.
Any one know why Rails says that "No route matches" when the request is an HTTP DELETE?
I finally got the delete route to work by using the route from this post
delete "/v1/devices/:device_id/registrations/:pass_type_id/:serial_number" => "users#delete_pass", :constraints => { :pass_type_id => /[^\/]+/ }
which has the constraint added:
:constraints => { :pass_type_id => /[^\/]+/ }

Undefined method failure_app for nil:NilClass

I am trying to use devise from a Rails app to grant access to a Sinatra application within the Rack middleware.
My config/routes.rb has:
authenticate "admin" do
mount Admins::Dashboard, :at => "/admins"
end
In my Sinatra app, I use:
before do
env["warden"].authenticate!(:scope => "admin")
end
get "/dashboard" do
erb :dashboard
end
Now, I get an error with the following stacktrace:
Started GET "/admins/dashboard" for 127.0.0.1 at 2012-10-11 08:45:13 +0200
NoMethodError (undefined method `failure_app' for nil:NilClass):
devise (2.1.2) lib/devise/delegator.rb:11:in `failure_app'
devise (2.1.2) lib/devise/delegator.rb:5:in `call'
warden (1.2.1) lib/warden/manager.rb:130:in `call_failure_app'
warden (1.2.1) lib/warden/manager.rb:116:in `process_unauthenticated'
warden (1.2.1) lib/warden/manager.rb:47:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
The error message is a complaint about missing configuration for customizing the warden failure app to point to sinatra.
Check out this previous answer and the related (detailed) blogpost about setting up Sinatra+Warden & Rails+Devise; hopefully the instructions there will help you implement the solution successfully.
Had the same error message and this comment on Github helped me out.
In my sessions_controller.rb I had:
sign_in(:user, #resource, store: false, bypass: false)
which I replaced with:
sign_in(:users, #resource, store: false, bypass: false)
for it to work.
Specifically, the issue was only happening after one user would delete his account... Also I am using devise_token_auth (hence the overriden sessions controller).

Rails connects to the database during the start of a HTTP/rack request

Is there a way to change this behavior? i.e make Rails lazily get the connection from the pool and not when the request comes in.
We are using Postgres as a secondary source of data, so if that secondary source is down, app should not be affected and we want to rescue from that.
Right now when postgres goes down, all requests get affected.
Any inputs would be appreciated.
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:1213:in `initialize'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:1213:in `new'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:1213:in `connect'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:329:in `initialize'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:309:in `new_connection'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:319:in `checkout_new_connection'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:241:in `block (2 levels) in checkout'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `loop'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `block in checkout'
vendor/ruby-1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:233:in `checkout'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:96:in `block in connection'
vendor/ruby-1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in `retrieve_connection'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:170:in `retrieve_connection'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:144:in `connection'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:67:in `rescue in call'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:61:in `call'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `_run__1061097989250305020__call__4547997776545495741__callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/logger.rb:26:in `call_app'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/logger.rb:16:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/request_id.rb:22:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:479:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:223:in `call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/deflater.rb:13:in `call'
vendor/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:535:in `process_client'
vendor/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:610:in `worker_loop'
This is due to the QueryCache middleware. Unless you want to monkey patch it, you can just remove it from the middleware stack:
config.middleware.delete ActiveRecord::QueryCache
you might need to remove ActiveRecord::ConnectionAdapters::ConnectionManagement middleware as well.

What does this mean? struct Arel::Attributes::Attribute not compatible (struct size differs)

I've just updated an app to rails 3.0.15, I'm not sure if that's the relevant bit, but I now get struct Arel::Attributes::Attribute not compatible (struct size differs) error right after running the server.
The log shows this:
tarted GET "/" for 127.0.0.1 at 2012-06-14 10:34:09 -0400
TypeError (struct Arel::Attributes::Attribute not compatible (struct size differs)):
Rendered gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.3ms)
SQL (1.9ms) describe `groups_users`
Rendered gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (239.8ms)
Rendered gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (244.9ms)
update
This problem seems to happen only when I use a certain url that loops back to localhost, namely live.dev:3000, it is fine with say localhost:3000, or another loop-back url.
This is the application trace
gems/ruby/1.9.1/gems/activerecord-3.0.15/lib/active_record/session_store.rb:58:in `load'
gems/ruby/1.9.1/gems/activerecord-3.0.15/lib/active_record/session_store.rb:58:in `unmarshal'
gems/ruby/1.9.1/gems/activerecord-3.0.15/lib/active_record/session_store.rb:131:in `data'
gems/ruby/1.9.1/gems/activerecord-3.0.15/lib/active_record/session_store.rb:298:in `block in get_session'
gems/ruby/1.9.1/gems/activesupport-3.0.15/lib/active_support/benchmarkable.rb:55:in `silence'
gems/ruby/1.9.1/gems/activerecord-3.0.15/lib/active_record/session_store.rb:294:in `get_session'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/session/abstract_store.rb:195:in `block in load_session'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/session/abstract_store.rb:223:in `stale_session_check!'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/session/abstract_store.rb:193:in `load_session'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/session/abstract_store.rb:121:in `load!'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/session/abstract_store.rb:113:in `load_for_read!'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/session/abstract_store.rb:53:in `[]'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/flash.rb:178:in `call'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/cookies.rb:302:in `call'
gems/ruby/1.9.1/gems/activerecord-3.0.15/lib/active_record/query_cache.rb:32:in `block in call'
gems/ruby/1.9.1/gems/activerecord-3.0.15/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
gems/ruby/1.9.1/gems/activerecord-3.0.15/lib/active_record/query_cache.rb:12:in `cache'
gems/ruby/1.9.1/gems/activerecord-3.0.15/lib/active_record/query_cache.rb:31:in `call'
gems/ruby/1.9.1/gems/activerecord-3.0.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
gems/ruby/1.9.1/gems/activesupport-3.0.15/lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/sendfile.rb:106:in `call'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
gems/ruby/1.9.1/gems/railties-3.0.15/lib/rails/rack/logger.rb:13:in `call'
gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/runtime.rb:17:in `call'
gems/ruby/1.9.1/gems/activesupport-3.0.15/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/lock.rb:13:in `block in call'
<internal:prelude>:10:in `synchronize'
gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/lock.rb:13:in `call'
gems/ruby/1.9.1/gems/actionpack-3.0.15/lib/action_dispatch/middleware/static.rb:30:in `call'
gems/ruby/1.9.1/gems/railties-3.0.15/lib/rails/application.rb:168:in `call'
gems/ruby/1.9.1/gems/railties-3.0.15/lib/rails/application.rb:77:in `method_missing'
gems/ruby/1.9.1/gems/railties-3.0.15/lib/rails/rack/log_tailer.rb:14:in `call'
gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/content_length.rb:13:in `call'
gems/ruby/1.9.1/gems/rack-1.2.5/lib/rack/handler/webrick.rb:52:in `service'
/Users/victorstan/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/victorstan/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/victorstan/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'