Settler 1.2.1 does not work with rails 3.1.0.rc4
jakobsack opened this issue · 5 comments
settler 1.2.1 does not work with rails 3.1.0.rc4. As soons as settler is listed in the Gemfile the server does not start giving the following errors:
jakob@halo:~/projekte/aktiv/maintenancetool$ rails s
/home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool.rb:388:in retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished) from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_specification.rb:107:in
retrieve_connection'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in connection' from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activerecord-3.1.0.rc4/lib/active_record/attribute_methods/primary_key.rb:42:in
get_primary_key'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activerecord-3.1.0.rc4/lib/active_record/attribute_methods/primary_key.rb:26:in reset_primary_key' from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activerecord-3.1.0.rc4/lib/active_record/attribute_methods/primary_key.rb:17:in
primary_key'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activerecord-3.1.0.rc4/lib/active_record/base.rb:1918:in attributes_protected_by_default' from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activemodel-3.1.0.rc4/lib/active_model/mass_assignment_security.rb:184:in
protected_attributes_configs'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activemodel-3.1.0.rc4/lib/active_model/mass_assignment_security.rb:98:in attr_protected' from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/settler-1.2.1/lib/setting.rb:10 from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in
require'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in require' from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in
load_dependency'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in new_constants_in' from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in
load_dependency'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in require' from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/settler-1.2.1/lib/settler.rb:4 from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in
require'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in require' from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in
each'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in require' from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in
each'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in require' from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler.rb:120:in
require'
from /home/jakob/projekte/aktiv/maintenancetool/config/application.rb:7
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:52:in require' from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:52 from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in
tap'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49
from script/rails:6:in `require'
from script/rails:6
Seems to be a problem that occurs more often. I should prbably convert it to a rails engine. Another solution I found, which is used by acts_as_commentable, is to force AR to create a connection. For this gem I think this should be added at the top of setting.rb:
ActiveRecord::Base.establish_connection unless ActiveRecord::Base.connected?
Could you by any chance try it out? Please send me a pull request if it works.
Simply adding the line does not work as expected, it says
jakob@halo:~/projekte/aktiv/maintenancetool$ rails s -p 3001
/home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_specification.rb:62:in `establish_connection': development database is not configured (ActiveRecord::AdapterNotSpecified)
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/settler-1.2.1/lib/setting.rb:1
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in `new_constants_in'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/settler-1.2.1/lib/settler.rb:4
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in `require'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in `require'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in `each'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in `require'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in `each'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in `require'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/bundler-1.0.15/lib/bundler.rb:120:in `require'
from /home/jakob/projekte/aktiv/maintenancetool/config/application.rb:7
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:52:in `require'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:52
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in `tap'
from /home/jakob/.rvm/gems/ruby-1.8.7-p334@maintenancetool31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49
from script/rails:6:in `require'
from script/rails:6
I'll look into it..
Fixed in v1.2.2. attr_protected tries to connect to the database for some reason, therefore I switched to attr_accessible instead.