question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicating assigned attributes

See original GitHub issue

Consider the following factory:

const User = require('models/user');

factory.define('user', User, {
  username: factory.sequence(n => `sherlock_${n}`),
  name: "Sherlock Holmes",
  password: "Password",
  passwordConfirmation: function() { return this.password; }
});

I’d expect the following to pass.

factory.build('user', { password: 'secret' })
  .then(user => expect(user.passwordConfirmation).to.equal('secret');

The syntax could differ but I think it’s common use case to duplicate (or do something else) on an already assigned attribute.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
chetanismcommented, Nov 2, 2016

Hi @jonatanklosko, the order of execution for these methods is attrs -> build -> create. As of now, we just have callbacks for afterBuild and afterCreate, hence the callbacks are not executed for attrs call. I’ll open another issue to have an afterAttrs callback.

1reaction
jonatankloskocommented, Oct 30, 2016

I’ve just realised that it’s not invoked after #attrs as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JR50043: Duplicate assigned attribute values can cause ... - IBM
When multiple products have values that are logically the same, using assigned values attributes creates duplication in the ATTRVAL and ATTRVALDESC tables ...
Read more >
Duplicate attributes, options and actions (on the same product ...
How to duplicate attributes/options on the same product (Retargert). This is a function to easily assign the options (or a part of them) ......
Read more >
How to duplicate atributes | WordPress.org
How to duplicate atributes · 1) Export the current item with your current attribute. · 2) Open the CSV and create a new...
Read more >
Duplicating Capability of "Assigned To" and "Owned ... - Jazz.net
I was looking to have two sections on a menu where (1) "Assigned to IT Team" and that would be associated with another...
Read more >
How to assign a count of duplicate attribute values to a new ...
Set a group by on the attribute with identical values, then look at the Count attribute output in the Summary. You will then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found