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 <email@example.com> wrote:ok, I thought about that. Would it be ok to like set the instant variable to a global and use that?$remaining = @remainingI 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> 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 firstname.lastname@example.org.
To post to this group, send email to email@example.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/46af96c5-857d-4742-894d-be66446bf1a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Posted by Ruby on Rails at 3:02 PM