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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:22:58+00:00 2026-06-07T01:22:58+00:00

I have a action something like: def show @p = Post.find(params[:id]) respond_to do |format|

  • 0

I have a action something like:

def show
    @p = Post.find(params[:id])
    respond_to do |format|
      format.html
      format.js
    end
  end

I get a url something:

http://localhost:3000/post/1
http://localhost:3000/post/2
http://localhost:3000/post/3
.
.
.

I want have a different version for this same action something like:

http://localhost:3000/v1/post/1
http://localhost:3000/v1/post/2
http://localhost:3000/v1/post/3
.
.
.

How can I do it?

I have take a look to this resources:

https://github.com/bploetz/versionist

http://railscasts.com/episodes/350-rest-api-versioning?view=asciicast

  • 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-06-07T01:23:00+00:00Added an answer on June 7, 2026 at 1:23 am

    I guess that the straight forward way would be to use namespacing, e.g. V1::PostsController, V2::PostsController, etc.

    See http://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing

    However, if you’re just producing an API, then you should better use https://github.com/intridea/grape , as it has the versioning support baked in.

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

Sidebar

Related Questions

I have a controller with a method like; def show if params[:format].eql?(pdf) // do
I have a url, something like this localhost:8080/foo.action?param1=7&param2=8&param3=6 When this is the Url (as
I have an action to generate pdfs with prawn def savepdfs respond_to do |format|
I want to have a route that looks something like: www.abc.com/companyName/Controller/Action/Id However, all the
I have to pass an object to an button's action... something like [myButton addTarget:self
I gotta be missing something. I have a controller action for short urls: def
I have following code: public static void ProcessStep(Action action) { //do something here if
I currently have some action associated with when the user types something in a
I have a action result method i would like to run. How can i
I have a Thread model which has a show page, and in that action's

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.