Merged r3398 from trunk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3465 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2010-02-20 10:40:02 +00:00
parent 13fb739b56
commit e5e5ad6b7a
4 changed files with 12 additions and 21 deletions
+5 -19
View File
@@ -1,30 +1,16 @@
module ObjectDaddyHelpers
# TODO: The gem or official version of ObjectDaddy doesn't set
# protected attributes so they need to be wrapped.
# TODO: Remove these three once everyone has ported their code to use the
# new object_daddy version with protected attribute support
def User.generate_with_protected(attributes={})
user = User.spawn_with_protected(attributes)
user.save
user
User.generate(attributes)
end
# TODO: The gem or official version of ObjectDaddy doesn't set
# protected attributes so they need to be wrapped.
def User.generate_with_protected!(attributes={})
user = User.spawn_with_protected(attributes)
user.save!
user
User.generate!(attributes)
end
# TODO: The gem or official version of ObjectDaddy doesn't set
# protected attributes so they need to be wrapped.
def User.spawn_with_protected(attributes={})
user = User.spawn(attributes) do |user|
user.login = User.next_login
attributes.each do |attr,v|
user.send("#{attr}=", v)
end
end
user
User.spawn(attributes)
end
# Generate the default Query