quirkey/static_model — Issue #3: belongs_to doesn't work for rails 3.2.2
Author: djiang
Created: 2012-03-06 03:34:47+00:00
State: open

This association doesn't seem to work anymore:

@@@
Lets say our Books have many Readers. Book is our StaticModel, but a Reader is an ActiveRecord model.

class Reader < ActiveRecord::Base
belongs_to :book, :foreign_key => 'book_id'
end
@@@

I get the following error:

@@@
NoMethodError: undefined method `scoped' for Book:Class
from /Users/david/.rvm/gems/ruby-1.9.2-p290/bundler/gems/static_model-1f2beb10aba5/lib/static_model/base.rb:210:in `method_missing'
from /Users/david/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations/association.rb:123:in `target_scope'
from /Users/david/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations/association.rb:87:in `scoped'
from /Users/david/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations/singular_association.rb:42:in `find_target'
from /Users/david/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations/association.rb:145:in `load_target'
from /Users/david/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations/association.rb:55:in `reload'
from /Users/david/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations/singular_association.rb:9:in `reader'
from /Users/david/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.2/lib/active_record/associations/builder/association.rb:44:in `block in define_readers'
from (irb):4
from /Users/david/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in `start'
from /Users/david/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in `start'
from /Users/david/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.2/lib/rails/commands.rb:41:in `'
from script/rails:6:in `require'
from script/rails:6:in `

'
@@@