I only want to use friendly_id generated slug in frontend not in admin. How to accomplished this?
in my admin controller:
def find_data
@product = Product.find(params[:id])
end
in my frontend controller:
def set_data
@product = current_user.products.friendly.find(params[:id])
end
Both code still return the same result (using friendly_id generated slug)
class Product < ActiveRecord::Base
extend FriendlyId
friendly_id :name, use: [:slugged, :finders, :history]
private
def should_generate_new_friendly_id?
new_record? || slug.blank? || name_changed?
end
anybody can help? thanks
UPDATE
I found the way to do this in AciveAdmin here. But Im not using ActiveAdmin