We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It can be cumbersome to add attributes such as
FactoryBurgers::Presenters.present("Foo") do attributes do |object| { id: object.id, name: object.name, description: object.description, foo: object.foo, bar: object.bar, baz: object.baz, } end end
Proposal: support
FactoryBurgers::Presenters.present("Foo") do attribute :id attribute :name attribute :description attribute :foo attribute :bar attribute :baz attribute(:custom_field) { |object| object.something_else } end
or even more terse, adding onto the existing attributes method
attributes
FactoryBurgers::Presenters.present("Foo") do attributes :id, :name, :description, :foo, :bar, :baz do |object| { custom_field: object.something_else, } end
FactoryBurgers::Presenters.present("Foo") do attributes do |object| object.attributes.slice("id", "name", "description", "foo", "bar", "baz").merge( {custom_field: object.something_else} ) end end
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It can be cumbersome to add attributes such as
Proposal: support
or even more terse, adding onto the existing
attributes
methodCurrent workaround
The text was updated successfully, but these errors were encountered: