I really like RABL, but it's seeming like it's going to clutter up my views folders with .rabl
files. I really want to ideally have a seperate API
views directory so it would be like this:
app/
views/
customers/
index.html.erb
show.html.erb
......
api/
v1/
customers/
index.json.rabl
show.json.rabl
What's the best way of achieving this? I'm using this tutorial:
http://railscasts.com/episodes/350-rest-api-versioning
To set up versioning but it doesn't support RABL. I have tried this in app/controllers/api/v1/customers_controller.rb
:
module Api
module V1
class CustomersController < ApplicationController
respond_to :json
def index
@customers = Customer.search(params[:page])
Rabl::Renderer.json(@customers, 'api/v1/customers/index')
end
end
end
end
But as expected that didn't seem to work.