Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure static attributes are executed before dynamic ones.
Static attributes must be executed first because dynamic attributes might rely on them. This is really important when using the :parent relationship. Previous code didn't work fine in situations like this one: Factory.define(:generic_user, :class => User) do |u| u.email { |user| "#{user.name}@example.com } end Factory.define(:flavio, :parent => :generic_user) do |u| u.name "flavio" end When building a :user object the previous code would have set the email attribute and then the name attribute. This results in a user object with an invalid email address: the 'name' attribute is yet not set while the 'email' attribute is evaluated. Closes #159
- Loading branch information
1 parent
841e012
commit 28f541e
Showing
5 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,10 @@ def initialize(name, value) | |
def add_to(proxy) | ||
proxy.set(name, @value) | ||
end | ||
end | ||
|
||
def priority | ||
0 | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters