Ruby on Rails Friday, March 3, 2017

On Fri, Mar 3, 2017 at 2:39 PM, Joe Guerra <JGuerra@jginfosys.com> wrote:
> Would it be ok to like set the instant variable
> to a global and use that?

Not if that value is going to be different for different users...

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

It's not.

Write a separate method that creates the instance variable and use
a before_filter to set it in the methods that need it.

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
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+unsubscribe@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/CACmC4yB_E6BW5eH%3DNLX-WFZY%3D%3Dn74k3at96ojpEfeJ%2BVHeE8oA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment