1

I have 2 tagging systems that belong to a question model - Topics and Place

They are both working, however I have a problem as a place can be more then 1 word e.g New York

So the current URL is /places/New%20York

I want it to be /places/New-York

I have tried using friendly_id for this but am not sure what to do really. I am using friendly_id for the slug for my questions: /questions/this-is-a-question

Which has this in question.rb model:

extend FriendlyId
friendly_id :title, use: [:slugged, :finders]


def slug_candidates
[
  :title,
  [:title, :id]
]
end

def should_generate_new_friendly_id?
    new_record?
end 

So I am not sure where to put the code for the Place slug.

I tried this but it did not work

friendly_id :title, use: [:slugged, :finders]
friendly_id :places, use: :slugged

Any help will be great! Thanks

jmromer
  • 2,212
  • 1
  • 12
  • 24
Lewis Frost
  • 557
  • 1
  • 5
  • 25

0 Answers0