Ruby on Rails Friday, March 3, 2017

As Colin mentioned you'd want to recalculate the variable in each method that it's used.  Global variables may work for your use case but they are not best practice and can lead to a mutable/mutex object which may not be your intended behavior.

On Mar 3, 2017, at 4:39 PM, Joe Guerra <> wrote:

ok, I thought about that.  Would it be ok to like set the instant variable to a global and use that?

$remaining = @remaining

I tried that, and it seems to have worked.  I not sure if it's the best practice though.

On Friday, March 3, 2017 at 5:21:22 PM UTC-5, Colin Law wrote:
On 3 March 2017 at 22:03, Joe Guerra <> wrote:
> Ok, how do I deal with that?

You have to recalculate the variable in each method that you need it.


You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment