I'm trying to figure out how to handle a user selecting a 'global' variable.
Specifically, I want a user to select a location (i.e. state or city) which then shows them all of the posts for those cities/states. I have part of this working, but what I'm really trying to figure out is where I should store such a variable and how.
I know, in theory, what I'm after on the code:
- User Selections Location (Which is stored somewhere/somehow)
- Code pulls all posts with that location from the database for display
I've seen a few posts that seem similar, like This one and a few others talking about application.yml
variables, but these don't seem to be user defined if I understand correctly.
One other idea that I've seen is storing this variable in a user session, but I don't want all visitors to have to login in order for this functionality.
Any direction would be much appreciated!