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 <jgue...@jginfosys.com> 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 <jgu...@jginfosys.com <javascript:>> 
> wrote: 
> > Ok, how do I deal with that? 
> 
> You have to recalculate the variable in each method that you need it. 
> 
> Colin 
> 
> -- 
> 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 rubyonrails-talk+unsubscr...@googlegroups.com 
> <mailto:rubyonrails-talk+unsubscr...@googlegroups.com>.
> To post to this group, send email to rubyonrails-talk@googlegroups.com 
> <mailto:rubyonrails-talk@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/46af96c5-857d-4742-894d-be66446bf1a0%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/rubyonrails-talk/46af96c5-857d-4742-894d-be66446bf1a0%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/54E01F4E-AC57-43BF-90F1-DB30C73F5345%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to