Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #active #admin
ADD COMMENT
Topic
Name
1+5 =