[LRUG] Proffer and introducing constraints to Rails
Simon Coffey
simon at tribesports.com
Thu Apr 5 07:09:54 PDT 2012
On 5 April 2012 14:02, Andrew Premdas <apremdas at gmail.com> wrote:
>
> On 4 April 2012 15:16, Simon Coffey <simon at tribesports.com> wrote:
>>
>> As a method of transferring data to the top-level template, instance
>> variables are sort of tolerable-ish, but as soon as they start being
>> accessed from within partials or helpers - anything that's not tied to
>> the specific controller action in which they're set, really - you're
>> creating a maintenance timebomb.
>
> Agreed, but does proffer stop this? If you can access the proffered
> variables in partials, then proffer is actually making things worse. However
> if proffered variables are hidden from partials then I can see it has value.
It works by converting the variables you proffer into locals
(https://github.com/hudge/proffer/blob/master/lib/proffer.rb#L57), so
as I understand it, partials wouldn't have access to any proffered
values unless they're explicitly passed down.
Cheers,
Simon
More information about the Chat
mailing list