Skip to content
Extraits de code Groupes Projets
paths.rb 581 octets
Newer Older
  • Learn to ignore specific revisions
  • module NavigationHelpers
      def path_to(page_name)
        case page_name
    
        when /^the home page$/
          root_path
    
        when /^its ([\w ]+) page$/
          send("#{$1.gsub(/\W+/, '_')}_path", @it)
        when /^the ([\w ]+) page$/
          send("#{$1.gsub(/\W+/, '_')}_path")
    
    Sarah Mei's avatar
    Sarah Mei a validé
        when /^my edit profile page$/
          edit_person_path(@me.person)
    
        when /^the requestor's profile page$/
          person_path(@me.reload.pending_requests.first.from)
    
          raise "Can't find mapping from \"#{page_name}\" to a path."
    
        end
      end
    end
    
    World(NavigationHelpers)