lib/mir_extensions.rb
def crud_links(model, instance_name, actions, args={})
      _html = ""
      _options = args.keys.empty? ? '' : ", #{args.map{|k,v| ":#{k} => #{v}"}}"
  
      if use_crud_icons
        if actions.include?(:show)
          _html << eval("link_to image_tag('/images/icons/view.png', :class => 'crud_icon'), model, :title => 'View'#{_options}")
        end
        if actions.include?(:edit)
          _html << eval("link_to image_tag('/images/icons/edit.png', :class => 'crud_icon'), edit_#{instance_name}_path(model), :title => 'Edit'#{_options}")
        end
        if actions.include?(:delete)
          _html << eval("link_to image_tag('/images/icons/delete.png', :class => 'crud_icon'), model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete'#{_options}")
        end
      else
        if actions.include?(:show)
          _html << eval("link_to 'View', model, :title => 'View', :class => 'crud_link'#{_options}")
        end
        if actions.include?(:edit)
          _html << eval("link_to 'Edit', edit_#{instance_name}_path(model), :title => 'Edit', :class => 'crud_link'#{_options}")
        end
        if actions.include?(:delete)
          _html << eval("link_to 'Delete', model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete', :class => 'crud_link'#{_options}")
        end
      end
      _html
    end
def crud_links(model, instance_name, actions, args={})
      _html = ""
      _options = args.keys.empty? ? '' : ", #{args.map{|k,v| ":#{k} => #{v}"}}"
  
      if use_crud_icons
        if actions.include?(:show)
          _html << eval("link_to image_tag('/images/icons/view.png', :class => 'crud_icon'), model, :title => 'View'#{_options}")
        end
        if actions.include?(:edit)
          _html << eval("link_to image_tag('/images/icons/edit.png', :class => 'crud_icon'), edit_#{instance_name}_path(model), :title => 'Edit'#{_options}")
        end
        if actions.include?(:delete)
          _html << eval("link_to image_tag('/images/icons/delete.png', :class => 'crud_icon'), model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete'#{_options}")
        end
      else
        if actions.include?(:show)
          _html << eval("link_to 'View', model, :title => 'View', :class => 'crud_link'#{_options}")
        end
        if actions.include?(:edit)
          _html << eval("link_to 'Edit', edit_#{instance_name}_path(model), :title => 'Edit', :class => 'crud_link'#{_options}")
        end
        if actions.include?(:delete)
          _html << eval("link_to 'Delete', model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete', :class => 'crud_link'#{_options}")
        end
      end
      _html
    end
def crud_links ( model , instance_name , actions , args = { } ) _html = "" _options = args . keys . empty? ? '' : ", #{args.map{|k,v| ":#{k} => #{v}"}}" if use_crud_icons if actions . include? ( :show ) _html << eval ( "link_to image_tag('/images/icons/view.png', :class => 'crud_icon'), model, :title => 'View'#{_options}" ) end if actions . include? ( :edit ) _html << eval ( "link_to image_tag('/images/icons/edit.png', :class => 'crud_icon'), edit_#{instance_name}_path(model), :title => 'Edit'#{_options}" ) end if actions . include? ( :delete ) _html << eval ( "link_to image_tag('/images/icons/delete.png', :class => 'crud_icon'), model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete'#{_options}" ) end else if actions . include? ( :show ) _html << eval ( "link_to 'View', model, :title => 'View', :class => 'crud_link'#{_options}" ) end if actions . include? ( :edit ) _html << eval ( "link_to 'Edit', edit_#{instance_name}_path(model), :title => 'Edit', :class => 'crud_link'#{_options}" ) end if actions . include? ( :delete ) _html << eval ( "link_to 'Delete', model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete', :class => 'crud_link'#{_options}" ) end end _html end
Display CRUD icons or links, according to setting in use_crud_icons method.

 In application_helper.rb:

   def use_crud_icons
     true
   end

 Then use in index views like this:

 <td class="crud_links"><%= crud_links(my_model, 'my_model', [:show, :edit, :delete]) -%></td>
Display CRUD icons or links according to setting in use_crud_icons method .