0

Friendly_id should generate same slug for inherited STI table.

I have a report model and a demo_report model which is inherited from report model, first a slug is generated for report using friendly_id. This is good e.g. test-report

But when same slug I want to generate for demo_report model it doesn't accept same slug like test-report , it adds some random_id e.g. test-report-4jfjfj4-4ufjks-787dns

I want to achieve

localhost:3000/reports/test-report

localhost:3000/demo-reports/test-report

Is it possible?, any help on this please

Sonalkumar sute
  • 2,565
  • 2
  • 17
  • 27
  • do you add friendly id config in demo report model? – Thanh Mar 03 '17 at 07:39
  • I have defined `friendly_id.rb` in `config/initializers` and extended `extend friendly_id` in report and demo-report both the models. what config you are talking about? – Sonalkumar sute Mar 03 '17 at 08:05
  • sorry, I means `extend friendly_id`. Do you add unique index to slug column of table? If so, I think it's not possible to have same slug. – Thanh Mar 03 '17 at 09:39

0 Answers0