Sergio Cambra .:: entreCables S.L. ::. wrote ...
> On Miércoles, 15 de Julio de 2009 19:50:35 David Cato escribió:
> > Any resolution on this?
> >
> > From what I've been able to determine while porting an app from 2.2 to
> > 2.3, it appears that the problem may be related to commit b93bda08 on
> > 2 May. That change does not appear in the rails-2.2 branch and the HMT
> > association works fine under 2.2 but the list view dies under 2.3.
> >
> > Modifying render_list_column, as follows (hopefully the patch isn't
> > mangled too badly), to ignore a through reflection on the associated
> > column seems to be working -- at least the list view comes up -- but I
> > haven't tested it too much yet. Can anyone confirm whether this is an
> > appropriate, or sufficient, fix?
>
> Thanks, I have committed a fix for it, it's a similar fix. I don't use
> has_many
> :through, can you try it?
Works great as long as the first record has an empty list of associated
records, but fails with the same error as the original code if there are
any associated records.
My app has the following models:
class Judge < ActiveRecord::Base
has_many :judgings
has_many :flights, :through => :judgings
end
class Flight < ActiveRecord::Base
has_many :judgings
has_many :judges, :through => :judgings
end
class Judging < ActiveRecord::Base
belongs_to :judge
belongs_to :flight
end
So judge.flights will either be an empty array, in which case your
change works, or an array of flights, in which case I still get
undefined method `judge_id=' for #<Flight:0x7fef80d95860>
Here's the backtrace from render_list_column down:
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/attribute_methods.rb:255:in
`method_missing'
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:2440:in
`send'
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:2440:in
`initialize'
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:2440:in
`each'
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:2440:in
`initialize'
/home/dcato/projects/openbrewcomp/vendor/plugins/active_scaffold/lib/active_record_permissions.rb:109:in
`new'
/home/dcato/projects/openbrewcomp/vendor/plugins/active_scaffold/lib/active_record_permissions.rb:109:in
`authorized_for?'
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_collection.rb:375:in
`send'
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_collection.rb:375:in
`method_missing_without_paginate'
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:2148:in
`with_scope'
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:206:in
`send'
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:206:in
`with_scope'
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_collection.rb:371:in
`method_missing_without_paginate'
/usr/lib64/ruby/gems/1.8/gems/mislav-will_paginate-2.3.11/lib/will_paginate/finder.rb:170:in
`method_missing'
/home/dcato/projects/openbrewcomp/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/list_column_helpers.rb:81:in
`render_list_column'
...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---