module ApplicationHelper [:project, :story, :bug, :task].each do |method| define_method("#{method}_path") do |*args| ticket_path(*args) end define_method("#{method.to_s.pluralize}_path") do |*args| tickets_path(*args) end end def ticket_types Ticket::ALLOWED_TYPES.each_with_object({}) do |type, hash| hash[type] = Ticket.filtered_type_class(type).new( creator: current_user, parent_id: params[:parent_id] ) end end def link_to_trackable activity, path link = send(:"#{path}_path", (activity.trackable || "deleted-#{activity.trackable_id}")) link_to((activity.trackable.try(:title) || "[Deleted Page]"), link) end end