Hi Rennan.
I know I can use something like: sequence(:email) {|n| "person#{
n}@example.com" } to fillup the field, but the problem with this is that n start in 1 or in a value that I can indicate, but I need to see that n start on the latest value that its on the database.
Suppose the primary key is age_id, what I need is to retrieve the latest value + 1 and use that value to fillup the other fields.
by the way, the code you provide throw the following:
[cchavez@dev01 pcd-bookeditor]$ RAILS_ENV=development rake test_data_strap:generate:master_series
rake aborted!
Both value and block given
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/definition_proxy.rb:36:in `add_attribute'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/definition_proxy.rb:91:in `method_missing'
/home/cchavez/scholastic/bitbucket/pcd-bookeditor/lib/test_data_strap/factories/lu_age.rb:4:in `block (2 levels) in <top (required)>'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/syntax/default.rb:22:in `instance_eval'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/syntax/default.rb:22:in `factory'
/home/cchavez/scholastic/bitbucket/pcd-bookeditor/lib/test_data_strap/factories/lu_age.rb:2:in `block in <top (required)>'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/syntax/default.rb:16:in `instance_eval'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/syntax/default.rb:16:in `run'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/syntax/default.rb:7:in `define'
/home/cchavez/scholastic/bitbucket/pcd-bookeditor/lib/test_data_strap/factories/lu_age.rb:1:in `<top (required)>'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/find_definitions.rb:20:in `block (2 levels) in find_definitions'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/find_definitions.rb:19:in `each'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/find_definitions.rb:19:in `block in find_definitions'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/find_definitions.rb:15:in `each'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/find_definitions.rb:15:in `find_definitions'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/gems/factory_girl-3.2.0/lib/factory_girl/reload.rb:8:in `reload'
/home/cchavez/scholastic/bitbucket/pcd-bookeditor/lib/test_data_strap/test_data_strap.rb:8:in `generate'
/home/cchavez/scholastic/bitbucket/pcd-bookeditor/lib/tasks/test_data_strap.rake:6:in `block (3 levels) in <top (required)>'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/bin/ruby_noexec_wrapper:14:in `eval'
/home/cchavez/.rvm/gems/ruby-1.9.3-p385@pcd-bookeditor/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => test_data_strap:generate:master_series
(See full trace by running task with --trace)