gregbell/active_admin — Issue #767: Helper for edit/show/destroy Link with an image
Author: fu-media
Created: 2011-11-21 04:33:46+00:00
State: open

i am trying to make nice helpers so that we can use onyl

````
edit(category)
destroy(post)
show(user)
````
and we get the selected link with a nice image.

can anyone tell me if i am doing it right or is there a better magical rails way to get the url?

````
def show(link)
link_to image_tag("admin/show.png"), eval("admin_#{object.class.to_s.downcase}_path(#{object.id})")
end

def edit(object)
link_to image_tag("admin/edit.png"), eval("edit_admin_#{object.class.to_s.downcase}_path(#{object.id})")
end

def destroy(link)
link_to image_tag("admin/destroy.png"), eval("admin_#{object.class.to_s.downcase}_path(#{object.id})"), :method=>:delete, :confirm=>"Do you really want to delete this?"
end
````