I downloaded the friendly_id gem to make my URLs more user friendly. To follow their instructions, I ask about it here, not about GitHub.
Here is my display method
def show
@movie = Movie.friendly.find(params[:id])
end
This is consistent with their documentation.
Finders are no longer overridden by default. If you want to do friendly finds, you must
do Model.friendly.find rather than Model.find. You can however restore FriendlyId
4-style finders by using the :finders addon:
In my Model.rb file, I have the following
extend FriendlyId
friendly_id :title, use: :slugged
From the documentation
friendly_id :foo, use: :slugged
also from their documentation
def set_restaurant
@restaurant = Restaurant.friendly.find(params[:id])
end
For reference, here is their guide.
Of course, I haven't created the migration yet, because I already created the table.
I'm not sure what my next step should be?
Thank you for your help.
source
share