jbuilder
jbuilder copied to clipboard
Jbuilder: generate JSON objects with a Builder-style DSL
I was messing around with making a project's Jbuilder renders more efficient the other day. I noticed that even empty collections trigger partial renders and take milliseconds for each, although...
Is there a way to ignore certain keys from being camelized with jbuilder? ```ruby json.key_format! camelize: :lower ```
Clean install of a new Rails 7 api_only app: ```config.api_only = true``` Added the jbuilder gem and generated a scaffold that has this line: ```render json: @practice_tests, status: :ok``` But...
Before change https://github.com/rails/jbuilder/commit/65dfb3305b1c1ebae550c420a6ab6bd0e21271ec you could pass the :force option to cache! This worked because cache! used Rails.cache.fetch which takes the force option. That commit rewrote cache to use Rails.cache.read and...
Hi, I ran into a very strange situation. ```ruby json.array! [1,2,3] do |i| json.cache! 'test' do json.name 'cache' end json.id i end ``` The code above will print ```javascript [...
When I'm trying to use partials to render associated object and the association is nil the response object is an empty array **[]** instead of **null** (like on standard attribute...
File Structure: config/initializers/jbuilder.rb ```ruby Jbuilder.ignore_nil Jbuilder.key_format camelize: :lower Jbuilder.deep_format_keys ``` config/routes.rb ```ruby namespace 'api', defaults: { format: :json } do namespace 'v1' do resource 'post', only: [:create] end end ```...
See https://github.com/rails/rails/pull/45383 When scaffolding a model (with `rails g scaffold ModelName`), the destroy method in the generated controller is missing a 302 status code. Adding this status code is recommended...
I'm having an issue debugging an error. We're getting a stack trace like: ``` JSON::GeneratorError: source sequence is illegal/malformed utf-8 from active_support/core_ext/object/json.rb:38:in `to_json' from active_support/core_ext/object/json.rb:38:in `to_json' from active_support/json/encoding.rb:57:in `to_json' from...
Hi, I'm using rails version 5.0.2 and jbuilder 2.6.3 Im having same problem as #116 , What could be possibly happening? because this bug was fixed here is my view.json.jbuilder...