I\'m using rails 3 and I have two models, venues and areas where each area has many venues and each venue belongs to one area.
I\'m trying to find a way of filtering the
You can find the Venues in your controller depending on whether an area is selected or not. You can modify the view to send the area name, instead of the area id(which might make it easier):
<%= select("area", "name", Area.all.collect(&:name)) %>
The controller would look something like this -
def index
if (params[:area] && Area.all.collect(&:name).include?(params[:area][:name]))
@venues = Venue.send(params[:area][:name].downcase)
else
@venues = Venue.all
end
end