simple_json
simple_json copied to clipboard
Application Layout Support
application.simple_json.rb
{
success: true,
data: yield
}
some_action.simple_json.rb
{
test_one: 'success',
test_two: 'success'
}
Expected Output:
{
success: true,
data: {
test_one: 'success',
test_two: 'success'
}
}
Actual Output:
{
test_one: 'success',
test_two: 'success'
}
How can I add application.simple_json.rb support?
Unfortunately layout is not supported yet.
But I'll work on it!
As a alternative solution for now, you may define a helper for the layout.
# app/helpers/application_helper.rb
module ApplicationHelper
def my_layout()
{
success: true,
data: yield
}
end
end
# some_action.simple_json.rb
-> {
my_layout do
{
test_one: 'success',
test_two: 'success'
}
end
}