I have the following query that selects * where display in the Zips table is equal to a column in the users table.
This works fine, but how do I select ANOTHER column from the Zips table to print it out?
Zip.where(:display => @user.location)
So, for example the users table has a location col and the zips table has a display and zipcode column. I am finding the proper row by matching location from users to the display in zips but need to pull out zipcodes from the matching entry in zips…
Assuming your
Ziptable has thezipcodefield:Or to put them in an array:
In a view: