blueprinter icon indicating copy to clipboard operation
blueprinter copied to clipboard

Not able to override association in view.

Open stlewis opened this issue 4 years ago • 0 comments

This may be related to #200, but just in case it's a different scenario, I decided to open a new ticket. I have a blueprint that looks like this:

class SomeBlueprint < BaseBlueprint
  identifier :id
  association :company, blueprint: CompanyBlueprint

  association :accounts, blueprint: AccountBlueprint do |ccc, options|
    ccc.consolidated_accounts.order(number: :asc)
  end

  view :company_view do
    transform LowerCamelTransformer
    exclude :display_type
    exclude :username

    association :accounts, blueprint: AccountBlueprint, view: :credential_view do |ccc, options|
      ccc.consolidated_accounts.order(number: :asc)
    end
  end
end

If I call SomeBlueprint.render(@thing, view: :company_view), I would expect the accounts association to be overwritten. What is actually happening is that the previously defined accounts association is being rendered.

stlewis avatar Mar 09 '20 19:03 stlewis