Skip to content
This repository

Rails Master Breaks #132

Closed
arunagw opened this Issue November 20, 2011 · 5 comments

5 participants

Arun Agrawal Nick Sieger Vincent Landgraf pgeez Paul
Arun Agrawal
Collaborator

After this commit rails/rails@bd2f5c0 Rails master is full with errors.

  1) Error:
test_allows_session_fixation(ActiveRecordStoreTest):
NoMethodError: undefined method `accept' for nil:NilClass
    /Users/arunagw/checkouts/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `to_sql'
    /Users/arunagw/checkouts/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:87:in `insert'
    /Users/arunagw/checkouts/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `insert'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/relation.rb:70:in `insert'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/persistence.rb:316:in `create'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/timestamp.rb:57:in `create'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/callbacks.rb:268:in `create'
    /Users/arunagw/checkouts/rails/activesupport/lib/active_support/callbacks.rb:392:in `_run_create_callbacks'
    org/jruby/RubyKernel.java:2093:in `send'
    /Users/arunagw/checkouts/rails/activesupport/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/callbacks.rb:268:in `create'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/persistence.rb:297:in `create_or_update'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/callbacks.rb:264:in `create_or_update'
    /Users/arunagw/checkouts/rails/activesupport/lib/active_support/callbacks.rb:410:in `_run_save_callbacks'
    org/jruby/RubyKernel.java:2093:in `send'
    /Users/arunagw/checkouts/rails/activesupport/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/callbacks.rb:264:in `create_or_update'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/persistence.rb:37:in `save'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/validations.rb:50:in `save'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/attribute_methods/dirty.rb:22:in `save'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/transactions.rb:241:in `save'
    /Users/arunagw/checkouts/rails/actionpack/test/../../activerecord/lib/active_record/transactions.rb:295:in `with_transaction_returning_status'

attr_accessor :visitor added.

Vincent Landgraf

I have de same problem with current rails 3.2.0.rc2 and the jdbc adapters.
I managed to figure out, that the visitor for the adapter is unset.

As a workaround one can use the following code in an initializer to fix the problem.

class ActiveRecord::ConnectionAdapters::SQLiteAdapter
  def visitor
    @visitor ||= Arel::Visitors::SQLite.new(self)
  end
end

Afaik the initializer should set the visitor. I don't know why it actually is not doing it at the moment.

pgeez

I'm very new to Ruby and noticed this same issue when running JRuby on Rails (3.2.0 - stable) with MySQL.

Added a similar line to the initializer of ActiveRecord::ConnectionAdapters::MysqlAdapter:

@visitor ||= Arel::Visitors::MySQL.new(self)
Florent Monbillard EppO referenced this issue in EppO/rolify January 24, 2012
Closed

Cannot define a global role #33

Nick Sieger
Owner

Fixed by #156.

Nick Sieger nicksieger closed this January 27, 2012
Paul

I am getting this issue with rails 3.2. Is the fix in the master? I am referencing ar-jdbc like this:
gem 'activerecord-jdbc-adapter', :git => "https://github.com/nicksieger/activerecord-jdbc-adapter.git", :branch => 'master'
gem 'activerecord-jdbcsqlite3-adapter'

I still get the error "undefined method `accept' for nil:NilClass".

Paul

Adding the initializer mentioned earlier does work as a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.