Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change returned format #399

Open
oliviermilla opened this issue Feb 5, 2013 · 0 comments
Open

Change returned format #399

oliviermilla opened this issue Feb 5, 2013 · 0 comments

Comments

@oliviermilla
Copy link

Hello,
I'm trying to define a specific format (let's call it myformat) so as to do special operations when requests are made in this format. So, in my controller I have something like this:

def index
    respond_to do |format|
        format.xml do
            #Some Code
        end
        format.json do
            #Some Code
        end
        format.myformat do
            #Some Code
        end
end

The format is declared in the initializers/mime_types.rb as:

Mime::Type.register 'application/myformat', :myformat

Sending requests to the server to the controller#index.myformat works fine except that the server response is a controller.myformat file. while I would like to get a controller.json one.

To be more precise, I would like RABL to render the views/controller/index.myformat.rabl BUT I want the response object to be built just as any json object with the .json extension?

Is there a way to do that with RABL? That would be much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant