How to solve Record not found error when using friendly_id in ruby on rails

If you are learning Ruby on rails and trying to add friendly_id in your application, you might face this error.

ActiveRecord::RecordNotFound in EventsController#show

error in rails
to solve this error all you have to do is , go to your event/user controller find the line
 Event.find(params[:id]) // Event or User whatever it is in your case
and replace it with 
 Event.friendly.find(params[:id])

This will solve the problem.

Comments

Popular Posts