If I have a user.rabl that is different for two different versions of the grape API, how do I get grape-rabl to render the correct one based on the grape api class setup?
class API::V1::Users < Grape::API
version 'v1', using: :header, vendor: 'me'
format :json
formatter :json, Grape::Formatter::Rabl
end
class API::V2::Users < Grape::API
version 'v2', using: :header, vendor: 'me'
format :json
formatter :json, Grape::Formatter::Rabl
end
I have application.rb set up like so:
class Application < Rails::Application
config.middleware.use(Rack::Config) do |env|
env['api.tilt.root'] = Rails.root.join "app", "views", "api", 'v1'
env['api.tilt.root'] = Rails.root.join "app", "views", "api", 'v2'
end
end
Given this setup, rabl just renders v2 of user.rabl since it was the last one. I would appreciate any help. Thank you!
If I have a user.rabl that is different for two different versions of the grape API, how do I get grape-rabl to render the correct one based on the grape api class setup?
Lets take this for an example:
File paths:
Grape API classes:
I have application.rb set up like so:
Given this setup, rabl just renders v2 of user.rabl since it was the last one. I would appreciate any help. Thank you!