On Nov 23, 2009, at 9:43 AM, John Firebaugh wrote:
>> I've been finding that autopropagation of controller assigns is
>> problematic even in the non-partial case. I think it might make sense
>> to use this to replace my NON_NEEDED_CONTROLLER_INSTANCE_VARIABLES
>> hack and have it work for direct widget instantiation and the
>> 'widget'
>> command as well. I.e. if it's set, controller assigns propagate only
>> if they are needed or passed explicitly via :locals.
>
> It looks like this is exactly what your
> ignore_extra_controller_assigns= option does -- in which case +1, I
> wholeheartedly support it. I would just drop
> NON_NEEDED_CONTROLLER_INSTANCE_VARIABLES, I think this can replace it
> entirely.
Thanks for the support, Alex and John!
NON_NEEDED_CONTROLLER_INSTANCE_VARIABLES is still needed, as far as I
can tell, in the case where you don't set
"Widget.ignore_extra_controller_assigns = true". Do you think we
should just make that always true for Erector when it's running as
part of Rails, and leave out the configurability? It would make things
simpler, to be sure; I just wanted to be as conservative as possible
with my original patch.
Alex: re: the naming issue -- I agree; the only issue with
"allow_undeclared_parameters" is that it sounds like it should apply
everywhere, and my patch only applies in the Rails case, and only to
the immediate view, not partials. (I really like it that Erector blows
up if I pass extra stuff to my widget, in general, just like Ruby
does...it's just this one case where it has issues.) I'd hate to see
someone say "Erector::Widget.allow_undeclared_parameters = true" and
then go on a wild-goose-chase for hours trying to figure out why it's
not doing what it claims. But I'm all for better names...just having
trouble coming up with one that's specific but less verbose. If we can
brainstorm one, I'll change it right away.
I also just added another commit (
http://github.com/ageweke/erector/commit/1cb39a3eb0af22adcd0b2a117d3a40c38afb4052
) that makes Erector work with the Cells plugin -- it doesn't by
default. I totally understand if we don't want that upstream; it's
safe and generic, but specific to this one interaction.
Assuming you're happy with them, what's the next step to getting these
upstream? I'm a Github newbie (the shock!) but am happy to do whatever
makes things easiest for you, too.
Thanks!
Andrew