Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4022280
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:27:20+00:00 2026-05-20T10:27:20+00:00

I’ve seen this question answered here for Rails 2, but not Rails 3. I

  • 0

I’ve seen this question answered here for Rails 2, but not Rails 3.

I have an app I’m running on localhost called Skynet, which provides one-click access to the scripts that I use regularly:

I have:

config/routes.rb:

Skynet::Application.routes.draw do
  resources :robots do
    member do
      get "cleaner"
    end
  end
end

app/controllers/robots_controller.rb:

class RobotsController < ApplicationController 
  def index
    respond_to do |format|
      format.html
    end
  end
  def cleaner
    @output = ''
    f = File.open("/Users/steven/Code/skynet/public/input/input.txt", "r") 
    f.each_line do |line|
      @output += line
    end
    output = Sanitize.clean(@output, :elements => ['title', 'h1', 'h2', 'h3', 'h4', 'p', 'td', 'li'], :attributes => {:all => ['class']}, :remove_contents => ['script'])
    newfile = File.new("/Users/steven/Code/skynet/public/output/result.txt", "w")
    newfile.write(output)
    newfile.close
    redirect_to :action => "index"
  end
end

(Will refactor later.)

In app/views/robots/index.html.haml I have:

= link_to "test", cleaner_robot_path

When I type rake routes, I get:

cleaner_robot GET    /robots/:id/cleaner(.:format) {:controller=>"robots", :action=>"cleaner"}

So why, then, when I point my browser at http://localhost:3000/, do I get the following?

ActionController::RoutingError in Robots#index

Showing /Users/steven/Code/skynet/app/views/robots/index.html.haml where line #1 raised:

No route matches {:action=>"cleaner", :controller=>"robots"}
Extracted source (around line #1):

1: = link_to "test", cleaner_robot_path
Rails.root: /Users/steven/Code/skynet

Application Trace | Framework Trace | Full Trace
app/views/robots/index.html.haml:1:in `_app_views_robots_index_html_haml___2129226934_2195069160_0'
app/controllers/robots_controller.rb:4:in `index'
Request

Parameters:

None
Show session dump

Show env dump

Response

Headers:

None
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:27:20+00:00Added an answer on May 20, 2026 at 10:27 am

    you defined cleaner as a member function of the resource robots this means you have to supply an id as you can see in your rake routes message /robots/:id/cleaner(.:format)

    So your link should look like

    = link_to "test", cleaner_robot_path(some_id)
    

    but

    I think you want to use cleaner as a collection function:

    Skynet::Application.routes.draw do
      resources :robots do
        collection do
          get "cleaner"
        end
      end
    end
    

    then your link has to look like:

    = link_to "test", cleaner_robots_path
    

    Notice that robot is now plural!

    According to your error message I guess you’ve tried that but used the collection in plural… Maybe you have to restart your server if you are in production mode.

    You can read more about this routing stuff in the Ruby on Rails Guide

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This could be a duplicate question, but I have no idea what search terms
I have a French site that I want to parse, but am running into
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.