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 6705501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:24:40+00:00 2026-05-26T07:24:40+00:00

if I do map.resources :users in routes.rb, the routes I get have (.:format) at

  • 0

if I do map.resources :users in routes.rb, the routes I get have (.:format) at the end of each route (rake routes).

How do I get rid of this in rails 2.3?

I’m pretty sure in 3.1.1 I can do something like :format=>false. Is this available in 2.3? Is there a monkey patch I can do to mimic :format=>false?

Thanks.

  • 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-26T07:24:41+00:00Added an answer on May 26, 2026 at 7:24 am

    Monkey patched. Blah. I really, really wanted to change the default behavior, but took into consideration potential future developers’ sensitivities.

    map.resource(s) ..., :format=>false now doesn’t include the format in the route

    config/initializers/resources.rb:

    module ActionController
      module Resources
        private
          def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil, resource_options = {} )
            if resource.has_action?(action)
              action_options = action_options_for(action, resource, method, resource_options)
              formatted_route_path = (resource.options[:format] == false ? route_path : "#{route_path}.:format")
    
              if route_name && @set.named_routes[route_name.to_sym].nil?
                map.named_route(route_name, formatted_route_path, action_options)
              else
                map.connect(formatted_route_path, action_options)
              end
            end
          end
      end
    end
    

    The change I made is here:

    formatted_route_path = (resource.options[:format] == false ? route_path : "#{route_path}.:format")
    

    It used to just be formatted_route_path = "#{route_path}.:format"

    To get it to apply to all routes, in routes.rb, I just wrapped all routes with map.with_options :format=>false do |map| ... end

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

Sidebar

Related Questions

I have a nested resource in my routes.rb like this: map.resources :users, :only =>
In my routes.rb I have this: map.namespace :admin do |admin| admin.resources :galleries do |galleries|
I have the following route map.resource :account, :controller => users map.resources :users and /account/new
I have these routes: map.resources :categories do |category| category.resources :sub_categories end map.resources :sub_categories do
My routes.rb look like this: #... map.resources :users map.root :controller => main #... My
I have a problem to upgrade my routes.rb file. I converted this route: map.resource
In this piece of code: ActionController::Routing::Routes.draw do |map| map.resources :line_items map.resources :orders map.resources :products
I was wondering why when you create restful routes in rails with map.resources it
I am having trouble with paths in ruby on rails My Routes: map.resources :companies
background: trying to use the twitter gem for ruby-on-rails. in routes: map.resources :twitter_sessions map.finalize_twitter_sessions

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.