Sha256: 2ae8fd1bc58a39ac503b146d4737bec0e2936e0d98dab25564e7bb049174bfeb
Contents?: true
Size: 591 Bytes
Versions: 3
Compression:
Stored size: 591 Bytes
Contents
# frozen_string_literal: true module Alba # Rails integration class Railtie < Rails::Railtie initializer 'alba.initialize' do Alba.inflector = :active_support ActiveSupport.on_load(:action_controller) do define_method(:serialize) do |obj, with: nil, &block| with.nil? ? Alba.resource_with(obj, &block) : with.new(obj) end define_method(:render_serialized_json) do |obj, with: nil, &block| json = with.nil? ? Alba.resource_with(obj, &block) : with.new(obj) render json: json end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
alba-3.4.0 | lib/alba/railtie.rb |
alba-3.3.3 | lib/alba/railtie.rb |
alba-3.3.2 | lib/alba/railtie.rb |