Displaying 1 result from an estimated 1 matches for "categories_of_cads_in_c".
2006 Dec 30
4
newbie question, "show items in selected city and category"
...such way: first, from cities listing, which
is produced by ''list'' method in cities_controller, the user chooses
city ( clicks on ''show'' link).
cities_controller#show contains the following:
def show
@city = City.find(params[:id])
@cads = @city.cads
@categories_of_cads_in_city = @cads.map {|cad|
cad.categories}.flatten.uniq
end
So, the user sees classified ads and categories of these ads:
cities/show.rhtml:
[...]
<% @cads.each do |cad| %>
<%=link_to cad.title,
:controller => "cads",
:action => "show",
:id => cad.id
%>...