You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class UserBlueprint < Blueprinter::Base
transform DefaultTransformer
view :normal do
transform ViewTransformer
end
view :extended do
include_view :normal
end
association :address, blueprint: AddressBlueprint
view :without_address do
exclude :address
end
end
As per the document, I should be able to see DefaultTransformer, but I don't see it.
For now, I edited the view like below to make it work
view :without_address do
transform DefaultTransformer
exclude :address
end
Expected Behavior
I should see the DefaultTransformer inside the view.
Steps To Reproduce
This is the sample blueprint I have
class UserBlueprint < Blueprinter::Base
transform DefaultTransformer
view :normal do
transform ViewTransformer
end
view :extended do
include_view :normal
end
association :address, blueprint: AddressBlueprint
view :without_address do
exclude :address
end
end
As per the document, I should be able to see DefaultTransformer, but I don't see it.
For now, I edited the view like below to make it work
view :without_address do
transform DefaultTransformer
exclude :address
end
Environment
- OS: MacOS 15.4.1 (24E263)
- Browser Name and version: Chrome
- Ruby Version: ruby-3.2.2
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Could you provide some additional information regarding the issue you're seeing (i.e. what's the output your seeing after calling .render before and after the change)?
I put together a simple example in a similar fashion, and the transformers are working as expected:
classTruncateTransformer < Blueprinter::Transformerdeftransform(hash,_object,_options)hash.transform_keys!{ |key| key.to_s.split('').first(3).join('')}endendclassDuplicateTransformer < Blueprinter::Transformerdeftransform(hash,_object,_options)hash.transform_keys!{ |key| key.to_s + key.to_s}endendclassUserBlueprint < Blueprinter::BasetransformTruncateTransformeridentifier:idfield:nameview:normaldotransformDuplicateTransformerendview:extendeddoinclude_view:normalfield:user_access_levelendview:another_viewdofield:updated_atendendUser=Struct.new(:id,:name,:user_access_level,:updated_at)# Only runs "TruncateTransformer"irb(main):039> UserBlueprint.render_as_hash(User.new(1,'Jake',3,Time.now))=>{"id"=>1,"nam"=>"Jake"}# Runs "TruncateTransformer" then "DuplicateTransformer"irb(main):040> UserBlueprint.render_as_hash(User.new(1,'Jake',3,Time.now),view: :normal)=>{"idid"=>1,"namnam"=>"Jake"}# Runs "TruncateTransformer" then "DuplicateTransformer"irb(main):041> UserBlueprint.render_as_hash(User.new(1,'Jake',3,Time.now),view: :extended)=>{"idid"=>1,"namnam"=>"Jake","useuse"=>3}# Only runs "TruncateTransformer" irb(main):042> UserBlueprint.render_as_hash(User.new(1,'Jake',3,Time.now),view: :another_view)=>{"id"=>1,"nam"=>"Jake","upd"=>2025-04-2622:15:09.656101 -0400}irb(main):043>
Is there an existing issue for this?
Is this a regression?
Current Behavior
This is the sample blueprint I have
As per the document, I should be able to see
DefaultTransformer
, but I don't see it.For now, I edited the view like below to make it work
Expected Behavior
I should see the DefaultTransformer inside the view.
Steps To Reproduce
This is the sample blueprint I have
As per the document, I should be able to see
DefaultTransformer
, but I don't see it.For now, I edited the view like below to make it work
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: