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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:23:57+00:00 2026-05-30T20:23:57+00:00

Using ROAR ( https://github.com/apotonick/roar ) and without using ActiveRecord or any view-templates I want

  • 0

Using ROAR ( https://github.com/apotonick/roar ) and without using ActiveRecord or any view-templates I want to:

  • use the default JSON rederer but my own mime type to render JSON with respond_with
  • use the default JSON parser but my own mime type to put entries of the POST-body into the params hash.

config/initializers/mime_types.rb:

Mime::Type.register "application/vnd.xxx-v1+json" , :xxx_v1

controllers/api/base_controller.rb

class Api::V1::BaseController < ActionController::Base
  respond_to :xxx_v1

  ActionController.add_renderer :xxx_v1 do |obj, options|
    json = obj.to_json
    self.content_type ||= Mime::Type.lookup('application/vnd.xxx-v1+json')
    self.response_body  = json
  end
end

controllers/api/user_controller.rb:

class Api::V1::UsersController < Api::V1::BaseController 

  def index
    respond_with User.all
  end
end

GET http://domain/users
Accept application/vnd.xxx-v1

ERROR: Missing template api/v1/users/index, api/v1/base/index with {:handlers=>[:erb, :builder], :formats=>[:xxx_v1], :locale=>[:en, :en]}

After reading several posts like
Rails Custom Renderer or rails 3 response format and versioning using vendor MIME type in the Accept header I still can’t get it work..

-=== small update ===-

When I use render directly in the controller, it’s working! Always problems with respond_with…

render :xxx_v1 => User.all
  • 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-30T20:23:58+00:00Added an answer on May 30, 2026 at 8:23 pm

    Solution for rendering:

    Put an empty method into your models:

    def to_xxx_v1
    end
    

    It is not called but has to be present for respond_with.

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

Sidebar

Related Questions

Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using WPF/PRISM I want to log my messages through ILoggerFacade to my GUI (A
using Interface Builder and Storyboared, I built UITabBarController with 3 views. By default, when
Using restlet, I want to make a post to android's c2dm service. I have
Using Google Maps InfoBox - http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html Currently the map will scroll - pan control
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
Using php/html, I want to retrieve email addresses (plus other information) from MySQL and
Using emacs on Ubuntu 11.10. I want to connect to a SQL Server database
Using VBScript, I want to add an additional button to Notepad labeled send .
Using jQuery and localStorage, I want to keep track of how many times a

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.