Problems overriding Rails generated attr_accessor method

138 views
Skip to first unread message

Jonathan Wallace

unread,
Mar 2, 2013, 1:08:43 PM3/2/13
to factor...@googlegroups.com
Hello,

When I attempt to override a Rails generated attr_accessor method, FactoryGirl.create fails.

See https://gist.github.com/wallace/5072249.  The failure occurs on line 29.

Is there a configuration setting I can do to not have to modify the method that overrides the Rails generated attr_accessor method?  

I've tried "ignore" and get the following error:

/Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/registry.rb:24:in `find': Trait not registered: title (ArgumentError)
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/decorator.rb:10:in `method_missing'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl.rb:91:in `trait_by_name'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/definition.rb:98:in `trait_by_name'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/definition.rb:90:in `block in base_traits'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/definition.rb:90:in `map'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/definition.rb:90:in `base_traits'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/definition.rb:114:in `block in aggregate_from_traits_and_self'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/definition.rb:113:in `tap'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/definition.rb:113:in `aggregate_from_traits_and_self'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/definition.rb:22:in `block in attributes'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/definition.rb:21:in `tap'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/definition.rb:21:in `attributes'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/factory.rb:110:in `block in attributes'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/factory.rb:109:in `tap'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/factory.rb:109:in `attributes'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/factory.rb:104:in `evaluator_class'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/factory.rb:36:in `run'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/factory_runner.rb:23:in `block in run'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.12/lib/active_support/notifications.rb:125:in `instrument'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/factory_runner.rb:22:in `run'
from /Users/jonathanwallace/.rvm/gems/ruby-1.9.3-p125/gems/factory_girl-3.4.2/lib/factory_girl/strategy_syntax_method_registrar.rb:19:in `block in define_singular_strategy_method'
from temp.rb:31:in `<main>'

Thanks,
 Jonathan
Reply all
Reply to author
Forward
0 new messages