I use rails-api and rabl gems to make api application. I don't want to put a lot of logic into rabl views but if that I want to extract it into helpers. Rails-api gem doesn't include helpers support (and thats ok) so how I can enable helpers into my json views?(what middleware I need to include, which modules etc)
In the controller that renders the view you have to
In my API application I created a RenderingController which acts as a superclass for all controllers that do render:
class RenderingController < ApplicationController
include AbstractController::Layouts
include AbstractController::Translation
include ActionController::ImplicitRender
include ActionController::Helpers
helper ApplicationHelper, OtherHelper
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With