simple_json icon indicating copy to clipboard operation
simple_json copied to clipboard

Application Layout Support

Open shetty-tejas opened this issue 2 years ago • 2 comments

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?

shetty-tejas avatar Jun 03 '23 06:06 shetty-tejas

Unfortunately layout is not supported yet. But I'll work on it!

AZQ1994 avatar Jun 26 '23 09:06 AZQ1994

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
}

AZQ1994 avatar Jun 26 '23 16:06 AZQ1994