Wednesday, 22 August 2012

Custamize active admin find_by request instead of ID

Hi,

I have a requirement, where I need to find the record with find_by_name in active admin. But by default active admin finds the records with id. After googling I came to see this can be done by using before_filter as below

ActiveAdmin.register Product do
    before_filter :only => [:show, :edit, :update, :destroy] do
        @product = Product.find_by_name(params[:id])
      end
end

Thank You,
Uma Mahesh.

No comments:

Post a Comment