0

i am using ruby on rails i have models -category -subcategory -city -firm

when i click on category it will show sub categories and permalink should be: example.com/category when i click subcategory it will show firms and city names. example.com/category/subcategory when i click on city name it will filter firms belongs to that city example.com/category/subcategory/city when i click on firm name it will show example.com/category/subcategory/city/firm-name

firms may have more than one sub category

i used premalink_fu but i could not do that sub category system. category,subcategory,city,firm tables have their own permalink field on db. but i don't know how to combine them dynamically.

i can do example.com/category but i cant do example.com/category/subcategory

how can i do that please help me

saravankg
  • 909
  • 1
  • 10
  • 21
kkalgidim
  • 1
  • 1

1 Answers1

0

I stored permalinks at mysql via permalink_fu plugin and then call as parameter for action show:

city show.rhtml

<%= link_to s.isim, {:controller => 'sehir', :action => 'goster', :kategori=>@kategori.permalink ,:altkategori=>@altkategori.permalink, :permalink=>s.permalink} -%> - 

route.rb

map.sehirs '/:kategori/:altkategori/:permalink', :controller => 'sehir', :action=>'goster'
jgauffin
  • 99,844
  • 45
  • 235
  • 372
kkalgidim
  • 1
  • 1