I have got a many to many relationship between these to models :-
user.rb and city.rb, so that I can access user.cities and city.users.
Once the user clicks add city I want to add those cities in the temp variable like this
temp = []
city = City.find(params[:id])
temp << city
then I want to iterate over the temp doing something like this temp.each do |t|...
then once the user clicks confirm my cities I want to add these cities in user.cities
What might be the best approach to get the desired result?
i think the best approach is to use javascript. Simply on click save cities ids in js, and on submit send them to appropriate action which will save them.