admin_data
admin_data copied to clipboard
Doesn't appear to work with friendly_id gem
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"
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
create a new initializer admin_data.rb and in that initializer add the above mentioned line.
Closing this ticket. If it is still an issue then let me know.
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...
I will look into it.