admin_data icon indicating copy to clipboard operation
admin_data copied to clipboard

Doesn't appear to work with friendly_id gem

Open bigfolio opened this issue 14 years ago • 5 comments

Installed admin_data in a Rails 3 app that also uses the friendly_id gem. I'm able to browse a table but when I try to select a record, I get an error like:

"User not found: slug-name"

bigfolio avatar Jan 18 '11 03:01 bigfolio

You need to do following

AdminData.config do |config|
  config.find_conditions =  {'User' => lambda {|params| {:conditions =>   ["cached_slug = ?", params[:id] ] } } }
end

More information at https://github.com/neerajdotname/admin_data/wiki/Customizing-admin_data-for-a-Rails-3-application

neerajsingh0101 avatar Jan 18 '11 14:01 neerajsingh0101

create a new initializer admin_data.rb and in that initializer add the above mentioned line.

neerajsingh0101 avatar Jan 18 '11 14:01 neerajsingh0101

Closing this ticket. If it is still an issue then let me know.

neerajsingh0101 avatar Feb 14 '11 07:02 neerajsingh0101

Even with find_conditions set, trying to delete or destroy the record still tries to look the item up by id with the slug: https://github.com/neerajdotname/admin_data/blob/master/app/controllers/admin_data/crud_controller.rb#L17

Thoughts? Alternatively, the modify_record partial could just pass the model.id in for :id...

christineyen avatar Aug 04 '11 01:08 christineyen

I will look into it.

neerajsingh0101 avatar Aug 04 '11 06:08 neerajsingh0101