Skip to content

Instantly share code, notes, and snippets.

@staycreativedesign
Last active January 22, 2019 18:09
Show Gist options
  • Save staycreativedesign/884b3be7700fa8f6ac8736935d1a5cf2 to your computer and use it in GitHub Desktop.
Save staycreativedesign/884b3be7700fa8f6ac8736935d1a5cf2 to your computer and use it in GitHub Desktop.
I want to route to the specific post like this /knowledge/:of_type/:id . get '/knowledge/:of_type/:id', to: 'posts#show', as: 'post' but the :of_type isnt enforced i can literally put anything on there . how can i make it that it adds whatever is in of_type into the url structure?
here is the schema of my post model
# == Schema Information
#
# Table name: posts
#
# id :bigint(8) not null, primary key
# author :string
# content :text
# title :string
# excerpt :text
# old_slug :string
# created_at :datetime
# subcategory_id :bigint(8)
# category_id :integer
# slug :string
# meta_description :string
# meta_slug :string
# meta_keywords :string
# meta_title :string
# shorten_url :string
# submenu_id :integer
# author_id :integer
# of_type :string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment