Answers for "active admin with friendly_id"

0

active admin with friendly_id

# app/admin/group.rb

  # find record with slug(friendly_id)
  controller do
    def find_resource
      begin
        scoped_collection.where(slug: params[:id]).first!
      rescue ActiveRecord::RecordNotFound
        scoped_collection.find(params[:id])
      end
    end
  end
Posted by: Guest on June-28-2021

Code answers related to "active admin with friendly_id"

Browse Popular Code Answers by Language