rails 3.2 nested scaffold error

80 views
Skip to first unread message

Nick Rogers

unread,
Jan 28, 2012, 5:56:45 PM1/28/12
to ActiveScaffold : Ruby on Rails plugin
In 3.2, I'm getting the following when clicking on certain nested scaffolds

undefined method `original_build_association_called=' for #<ActiveRecord::Reflection::AssociationReflection:0x10d3c2428>

active_scaffold has active_association_reflection.rb to fix some bug in rails.
...

I can't figure out if this fix is still needed or not. It seems like it is. However the original_build_association_called method no longer exists in 3.2, so I am not sure how to fix this correctly.

Nick Rogers

unread,
Jan 28, 2012, 9:11:30 PM1/28/12
to ActiveScaffold : Ruby on Rails plugin
Also getting this error in some of my scaffolds when clicking Create.

Deleting lib/active_scaffold/extensions/active_association_reflection.rb fixes the problem, but I am unsure if this leaves something else with STI broken.

Nick Rogers

unread,
Jan 29, 2012, 12:40:44 PM1/29/12
to ActiveScaffold : Ruby on Rails plugin
As far as I can tell, the underlying issue with STI has not been fixed
in 3.2 (building an sti model from an association still fails). The
pull request referenced in active_scaffold code was closed and never
committed to rails.

I think the patch still works, but setting
self.original_build_association_called fails and is no longer
necessary because it was just some internal rails mechanism.

Rails 3.1 code has:
# This is a hack so that we can tell if build_association was
overridden, in order to
# provide an appropriate deprecation if the overridden method
ignored the &block. Please
# see Association#build_record for details.
attr_accessor :original_build_association_called # :nodoc

I'm going to remove setting "original_build_association_called" from
my fork, but I don't think removing the entire patch is a good idea,
which some other active_scaffold forks have started to do.

Can anyone comment otherwise?

On Jan 28, 9:11 pm, Nick Rogers <ncrog...@gmail.com> wrote:
> Also getting this error in some of my scaffolds when clicking Create.
>
> Deleting lib/active_scaffold/extensions/active_association_reflection.rb
> fixes the problem, but I am unsure if this leaves something else with STI
> broken.
>
>
>
>
>
>
>
> On Sat, Jan 28, 2012 at 5:56 PM, Nick Rogers <ncrog...@gmail.com> wrote:
> > In 3.2, I'm getting the following when clicking on certain nested scaffolds
>
> > undefined method `original_build_association_called=' for
> > #<ActiveRecord::Reflection::AssociationReflection:0x10d3c2428>
>
> > active_scaffold has active_association_reflection.rb to fix some bug in
> > rails.
> > # Bugfix: building an sti model from an association fails
> > #
> >https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6...
> > #https://github.com/rails/rails/issues/815
> > #https://github.com/rails/rails/pull/1686

clyfe

unread,
Jan 30, 2012, 5:21:11 AM1/30/12
to actives...@googlegroups.com
See my 3.2 compatibility monkeypatch in the meantime  https://gist.github.com/1703714
Reply all
Reply to author
Forward
0 new messages