Search code examples
ruby-on-railsjson-apiapi-versioning

Rails API versioning and forum_url


I try to add the location header to my versioned API.

NoMethodError (undefined method `forum_url' for #<V1::ForumsController:0x00000004fabaa0>):app/controllers/v1/forums_controller.rb:24:in `create'

How can I override the render location: forum helper to use v1_forum_urlinstead of forum_url?


Solution

  • You could simply define a method forum_url in your controller:

    def forum_url
      v1_forum_url
    end
    

    Or pass a custom method to location parameter.